diff --git a/src/litegraph.ts b/src/litegraph.ts index 2a169ab2b..1e7bd3688 100644 --- a/src/litegraph.ts +++ b/src/litegraph.ts @@ -22,7 +22,6 @@ import type { ColorOption, IColorable, } 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" @@ -75,8 +74,8 @@ export { Size, ColorOption, IColorable, - isColorable, } +export { isColorable } from "./utils/type" export { IWidget } export { LGraphBadge, BadgePosition } export { SlotShape, LabelPosition, SlotDirection, SlotType } diff --git a/src/typeGuards.ts b/src/typeGuards.ts deleted file mode 100644 index 3a1528555..000000000 --- a/src/typeGuards.ts +++ /dev/null @@ -1,8 +0,0 @@ -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 -} diff --git a/src/utils/type.ts b/src/utils/type.ts index b6dc33266..0b1be57b8 100644 --- a/src/utils/type.ts +++ b/src/utils/type.ts @@ -1,3 +1,5 @@ +import type { IColorable } from "@/interfaces" + /** * Converts a plain object to a class instance if it is not already an instance of the class. * @param cls The class to convert to @@ -7,3 +9,10 @@ export function toClass(cls: new (plain: P) => C, obj: P | C): C { return obj instanceof cls ? obj : new cls(obj as P) } + +/** + * 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 +}