From 2b8d3548627c8185dee33abdac7766efebbdec91 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Sat, 6 Sep 2025 20:27:44 -0700 Subject: [PATCH] improve type narrowing syntax (#5380) --- src/composables/graph/useGraphNodeManager.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/composables/graph/useGraphNodeManager.ts b/src/composables/graph/useGraphNodeManager.ts index bb9301488..4a81c78af 100644 --- a/src/composables/graph/useGraphNodeManager.ts +++ b/src/composables/graph/useGraphNodeManager.ts @@ -235,11 +235,15 @@ export const useGraphNodeManager = (graph: LGraph): GraphNodeManager => { } if (typeof value === 'object') { // Check if it's a File array - if (Array.isArray(value) && value.every((item) => item instanceof File)) { - return value as File[] + if ( + Array.isArray(value) && + value.length > 0 && + value.every((item): item is File => item instanceof File) + ) { + return value } // Otherwise it's a generic object - return value as object + return value } // If none of the above, return undefined console.warn(`Invalid widget value type: ${typeof value}`, value)