diff --git a/src/composables/usePaste.ts b/src/composables/usePaste.ts index 5e8c31b17..31b8d71f3 100644 --- a/src/composables/usePaste.ts +++ b/src/composables/usePaste.ts @@ -54,8 +54,7 @@ export const usePaste = () => { graph.change() } const blob = item.getAsFile() - // @ts-expect-error: Property 'pasteFile' does not exist on type 'LGraphNode'. - imageNode?.pasteFile(blob) + imageNode?.pasteFile?.(blob) return } } diff --git a/src/scripts/widgets.ts b/src/scripts/widgets.ts index 12e6e5aeb..8edb820ff 100644 --- a/src/scripts/widgets.ts +++ b/src/scripts/widgets.ts @@ -730,7 +730,6 @@ export const ComfyWidgets: Record = { return handled } - // @ts-expect-error node.pasteFile = function (file) { if (file.type.startsWith('image/')) { const is_pasted = diff --git a/src/types/litegraph-augmentation.d.ts b/src/types/litegraph-augmentation.d.ts index 5c916fb2d..e276884d1 100644 --- a/src/types/litegraph-augmentation.d.ts +++ b/src/types/litegraph-augmentation.d.ts @@ -102,6 +102,8 @@ declare module '@comfyorg/litegraph' { imageOffset?: number /** Set by DOM widgets */ freeWidgetSpace?: number + /** Callback for pasting an image file into the node */ + pasteFile?(file: File): void } interface INodeSlot {