refactor(core): remove null as return type of data in useNodesData (#1575)

* refactor(core): remove `null` as return type of data

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>

* chore(changeset): add

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>

---------

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2024-08-19 18:19:04 +02:00
parent 2976b11025
commit 1d772af4a4
2 changed files with 8 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@vue-flow/core": minor
---
Remove `null` as possible return type of data in `useNodesData`
@@ -7,7 +7,7 @@ import { useVueFlow } from './useVueFlow'
interface NodeData<NodeType extends Node = GraphNode> { interface NodeData<NodeType extends Node = GraphNode> {
id: string id: string
type: NodeType['type'] type: NodeType['type']
data: NonNullable<NodeType['data']> | null data: NonNullable<NodeType['data']>
} }
/** /**
@@ -42,7 +42,7 @@ export function useNodesData(_nodeIds: any): any {
return { return {
id: node.id, id: node.id,
type: node.type, type: node.type,
data: node.data ?? null, data: node.data,
} }
} }
@@ -58,7 +58,7 @@ export function useNodesData(_nodeIds: any): any {
data.push({ data.push({
id: node.id, id: node.id,
type: node.type, type: node.type,
data: node.data ?? null, data: node.data,
}) })
} }
} }