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.
This commit is contained in:
@@ -9,7 +9,7 @@ import { Optional } from '../utils/types';
|
|||||||
*/
|
*/
|
||||||
export type NodeBase<
|
export type NodeBase<
|
||||||
NodeData extends Record<string, unknown> = Record<string, unknown>,
|
NodeData extends Record<string, unknown> = Record<string, unknown>,
|
||||||
NodeType extends string = string
|
NodeType extends string | undefined = string | undefined
|
||||||
> = {
|
> = {
|
||||||
/** Unique id of a node */
|
/** Unique id of a node */
|
||||||
id: string;
|
id: string;
|
||||||
@@ -20,7 +20,7 @@ export type NodeBase<
|
|||||||
/** Arbitrary data passed to a node */
|
/** Arbitrary data passed to a node */
|
||||||
data: NodeData;
|
data: NodeData;
|
||||||
/** Type of node defined in nodeTypes */
|
/** Type of node defined in nodeTypes */
|
||||||
type?: NodeType;
|
type: NodeType;
|
||||||
/** Only relevant for default, source, target nodeType. controls source position
|
/** Only relevant for default, source, target nodeType. controls source position
|
||||||
* @example 'right', 'left', 'top', 'bottom'
|
* @example 'right', 'left', 'top', 'bottom'
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user