From 9cab0257d66305ae863442a334885ca324a5986f Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Tue, 6 Dec 2022 16:36:00 +0100 Subject: [PATCH] refactor(core): add `HandleConnectableFunc` type Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- packages/core/src/types/handle.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/core/src/types/handle.ts b/packages/core/src/types/handle.ts index 2376f491..f29e2fad 100644 --- a/packages/core/src/types/handle.ts +++ b/packages/core/src/types/handle.ts @@ -22,6 +22,8 @@ export type ValidConnectionFunc = ( elements: { edges: GraphEdge[]; sourceNode: GraphNode; targetNode: GraphNode }, ) => boolean +export type HandleConnectableFunc = (node: GraphNode, connectedEdges: GraphEdge[]) => boolean + /** * set to true to allow unlimited connections, * single for only one connection @@ -29,7 +31,7 @@ export type ValidConnectionFunc = ( * * if set to single and the handle already has more than one connection, it will act the same as setting it to false */ -export type HandleConnectable = boolean | 'single' | ((node: GraphNode, connectedEdges: GraphEdge[]) => boolean) +export type HandleConnectable = boolean | 'single' | HandleConnectableFunc export interface HandleProps { /** Unique id of handle element */