Updated NodeBase to allow undefined types and still handle explicit ones

Updated svelte and react packages to accommodate this
This commit is contained in:
fezproof
2024-09-18 11:50:21 +08:00
parent 64c36470cd
commit 37e9f02f80
3 changed files with 11 additions and 5 deletions
+9 -3
View File
@@ -19,8 +19,6 @@ export type NodeBase<
position: XYPosition;
/** Arbitrary data passed to a node */
data: NodeData;
/** Type of node defined in nodeTypes */
type: NodeType;
/** Only relevant for default, source, target nodeType. controls source position
* @example 'right', 'left', 'top', 'bottom'
*/
@@ -63,7 +61,15 @@ export type NodeBase<
width?: number;
height?: number;
};
};
} & (undefined extends NodeType
? {
/** Type of node defined in nodeTypes */
type?: string | undefined;
}
: {
/** Type of node defined in nodeTypes */
type: NodeType;
});
export type InternalNodeBase<NodeType extends NodeBase = NodeBase> = NodeType & {
measured: {