Compare commits

...

1 Commits

Author SHA1 Message Date
Kelly Yang
d7483aaaac refactor: augment Window interface with LiteGraph globals
Declares the nine LiteGraph properties assigned to window for backward
compatibility (LiteGraph, LGraph, LLink, LGraphNode, LGraphGroup,
DragAndScale, LGraphCanvas, ContextMenu, LGraphBadge) directly in
useGlobalLitegraph.ts where the imports already exist, removing all
nine @ts-expect-error suppressions from the file.

Part of #11092 - Reduce type suppression comments (Phase 1).
2026-04-16 18:57:50 -07:00

View File

@@ -10,26 +10,31 @@ import {
LiteGraph
} from '@/lib/litegraph/src/litegraph'
declare global {
interface Window {
LiteGraph: typeof LiteGraph
LGraph: typeof LGraph
LLink: typeof LLink
LGraphNode: typeof LGraphNode
LGraphGroup: typeof LGraphGroup
DragAndScale: typeof DragAndScale
LGraphCanvas: typeof LGraphCanvas
ContextMenu: typeof ContextMenu
LGraphBadge: typeof LGraphBadge
}
}
/**
* Assign all properties of LiteGraph to window to make it backward compatible.
*/
export const useGlobalLitegraph = () => {
// @ts-expect-error fixme ts strict error
window['LiteGraph'] = LiteGraph
// @ts-expect-error fixme ts strict error
window['LGraph'] = LGraph
// @ts-expect-error fixme ts strict error
window['LLink'] = LLink
// @ts-expect-error fixme ts strict error
window['LGraphNode'] = LGraphNode
// @ts-expect-error fixme ts strict error
window['LGraphGroup'] = LGraphGroup
// @ts-expect-error fixme ts strict error
window['DragAndScale'] = DragAndScale
// @ts-expect-error fixme ts strict error
window['LGraphCanvas'] = LGraphCanvas
// @ts-expect-error fixme ts strict error
window['ContextMenu'] = ContextMenu
// @ts-expect-error fixme ts strict error
window['LGraphBadge'] = LGraphBadge
}