From 64c36470cdc91bd8b6683051fad7c4e340876ab8 Mon Sep 17 00:00:00 2001 From: Ben Chidlow <26830309+fezproof@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:42:21 +0800 Subject: [PATCH] Update nodes.ts to allow strong NodeType Update the NodeBase type to have a stronger NodeType field that can be undefined even if you specifically define it. --- packages/system/src/types/nodes.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/system/src/types/nodes.ts b/packages/system/src/types/nodes.ts index b405b5ba..ae4bbc27 100644 --- a/packages/system/src/types/nodes.ts +++ b/packages/system/src/types/nodes.ts @@ -9,7 +9,7 @@ import { Optional } from '../utils/types'; */ export type NodeBase< NodeData extends Record = Record, - NodeType extends string = string + NodeType extends string | undefined = string | undefined > = { /** Unique id of a node */ id: string; @@ -20,7 +20,7 @@ export type NodeBase< /** Arbitrary data passed to a node */ data: NodeData; /** Type of node defined in nodeTypes */ - type?: NodeType; + type: NodeType; /** Only relevant for default, source, target nodeType. controls source position * @example 'right', 'left', 'top', 'bottom' */