[Cleanup] Remove LiteGraph global type declarations (#2745)

This commit is contained in:
Chenlei Hu
2025-02-26 21:50:41 -05:00
committed by GitHub
parent e843f53799
commit 0bc66965f0
3 changed files with 6 additions and 28 deletions

View File

@@ -1,22 +0,0 @@
/**
Extended types for litegraph, to be merged upstream once it has stabilized.
Augmenting the LiteGraph type really didn't want to work, however doing it like this seems to allow it.
*/
declare module '@comfyorg/litegraph' {
interface LiteGraphExtended {
search_filter_enabled: boolean
middle_click_slot_add_default_node: boolean
registered_node_types: Record<string, LGraphNodeConstructor>
registered_slot_out_types: Record<string, { nodes: string[] }>
registered_slot_in_types: Record<string, { nodes: string[] }>
slot_types_out: string[]
slot_types_default_out: Record<string, string[]>
slot_types_default_in: Record<string, string[]>
isValidConnection(type_a: ISlotType, type_b: ISlotType): boolean
}
import type { LiteGraph as LG } from '@comfyorg/litegraph/dist/litegraph'
export const LiteGraph: LiteGraphExtended & typeof LG
export * from '@comfyorg/litegraph/dist/litegraph'
}

View File

@@ -49,8 +49,9 @@ export class ConnectingLinkImpl implements ConnectingLink {
this.releaseSlotType === 'output' ? newNode.outputs : newNode.inputs
if (!newNodeSlots) return
const newNodeSlot = newNodeSlots.findIndex((slot: INodeSlot) =>
LiteGraph.isValidConnection(slot.type, this.type)
const newNodeSlot = newNodeSlots.findIndex(
(slot: INodeSlot) =>
this.type && LiteGraph.isValidConnection(slot.type, this.type)
)
if (newNodeSlot === -1) {