diff --git a/packages/core/src/composables/useNodesData.ts b/packages/core/src/composables/useNodesData.ts index e9afc4fb..9c1e8ca2 100644 --- a/packages/core/src/composables/useNodesData.ts +++ b/packages/core/src/composables/useNodesData.ts @@ -4,7 +4,11 @@ import type { GraphNode, Node } from '../types' import { warn } from '../utils' import { useVueFlow } from './useVueFlow' -type NodeData = NonNullable & { id: string; type: NodeType['type'] } +interface NodeData { + id: string + type: NodeType['type'] + data: NonNullable | null +} /** * Composable for receiving data of one or multiple nodes @@ -38,14 +42,14 @@ export function useNodesData(_nodeIds: any): any { return { id: node.id, type: node.type, - data: node.data, + data: node.data ?? null, } } return null } - const data = [] + const data: NodeData[] = [] for (const nodeId of nodeIds) { const node = findNode(nodeId) @@ -54,7 +58,7 @@ export function useNodesData(_nodeIds: any): any { data.push({ id: node.id, type: node.type, - data: node.data, + data: node.data ?? null, }) } }