diff --git a/src/interfaces.ts b/src/interfaces.ts index 250bae038e..f0a0c72b3f 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -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. * diff --git a/src/litegraph.ts b/src/litegraph.ts index 1cfcfe2dff..7857799b2b 100644 --- a/src/litegraph.ts +++ b/src/litegraph.ts @@ -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" diff --git a/src/typeGuards.ts b/src/typeGuards.ts new file mode 100644 index 0000000000..3a1528555f --- /dev/null +++ b/src/typeGuards.ts @@ -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 +}