mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-08 06:30:04 +00:00
[nit] Move isColorable out of interfaces.ts (#564)
This commit is contained in:
@@ -83,13 +83,6 @@ export interface IColorable {
|
||||
getColorOption(): ColorOption | null
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an object is an instance of {@link IColorable}.
|
||||
*/
|
||||
export const isColorable = (obj: unknown): obj is IColorable => {
|
||||
return typeof obj === "object" && obj !== null && "setColorOption" in obj && "getColorOption" in obj
|
||||
}
|
||||
|
||||
/**
|
||||
* An object that can be pinned.
|
||||
*
|
||||
|
||||
@@ -22,7 +22,7 @@ import type {
|
||||
ColorOption,
|
||||
IColorable,
|
||||
} from "./interfaces"
|
||||
import { isColorable } from "./interfaces"
|
||||
import { isColorable } from "./typeGuards"
|
||||
import type { SlotShape, LabelPosition, SlotDirection, SlotType } from "./draw"
|
||||
import type { IWidget } from "./types/widgets"
|
||||
import type { RenderShape, TitleMode } from "./types/globalEnums"
|
||||
|
||||
8
src/typeGuards.ts
Normal file
8
src/typeGuards.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { IColorable } from "@/interfaces"
|
||||
|
||||
/**
|
||||
* Checks if an object is an instance of {@link IColorable}.
|
||||
*/
|
||||
export const isColorable = (obj: unknown): obj is IColorable => {
|
||||
return typeof obj === "object" && obj !== null && "setColorOption" in obj && "getColorOption" in obj
|
||||
}
|
||||
Reference in New Issue
Block a user