Skip to content

Commit

Permalink
Type INodeOutputSlot widget hack on PrimitiveNode
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Feb 25, 2025
1 parent c20ea0c commit 6724c19
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/extensions/core/widgetInputs.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @ts-strict-ignore
import { LGraphNode, LiteGraph } from '@comfyorg/litegraph'
import type {
IFoundSlot,
INodeInputSlot,
INodeOutputSlot,
IWidget,
LiteGraphCanvasEvent
} from '@comfyorg/litegraph'
import type { IFoundSlot } from '@comfyorg/litegraph'
import { INodeSlot } from '@comfyorg/litegraph'

import { useNodeDefStore } from '@/stores/nodeDefStore'
import { useSettingStore } from '@/stores/settingStore'
Expand Down Expand Up @@ -422,7 +422,7 @@ export class PrimitiveNode extends LGraphNode {
}
}

export function getWidgetConfig(slot: INodeSlot) {
export function getWidgetConfig(slot: INodeInputSlot | INodeOutputSlot) {
return slot.widget[CONFIG] ?? slot.widget[GET_CONFIG]?.() ?? ['*', {}]
}

Expand Down
8 changes: 8 additions & 0 deletions src/types/litegraph-augmentation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ declare module '@comfyorg/litegraph' {
/** Callback for pasting multiple files into the node */
pasteFiles?(files: File[]): void
}
/**
* Only used by the Primitive node. Primitive node is using the widget property
* to store/access the widget config.
* We should remove this hacky solution once we have a proper solution.
*/
interface INodeOutputSlot {
widget?: IWidget
}
}

/**
Expand Down

0 comments on commit 6724c19

Please sign in to comment.