extend onBeforeConnect type to allow void & null & false

This commit is contained in:
peterkogo
2025-08-19 15:14:39 +02:00
parent 65caf56c76
commit 1eba8d5a78
2 changed files with 3 additions and 3 deletions

View File

@@ -98,7 +98,7 @@
});
function onConnectExtended(connection: Connection) {
const edge = store.onbeforeconnect?.(connection) ?? connection;
const edge = store.onbeforeconnect ? store.onbeforeconnect(connection) : connection;
if (!edge) {
return;

View File

@@ -38,11 +38,11 @@ export type OnDelete<NodeType extends Node = Node, EdgeType extends Edge = Edge>
export type OnBeforeConnect<EdgeType extends Edge = Edge> = (
connection: Connection
) => EdgeType | Connection | void;
) => EdgeType | Connection | void | false | null;
export type OnBeforeReconnect<EdgeType extends Edge = Edge> = (
newEdge: EdgeType,
oldEdge: EdgeType
) => EdgeType | void;
) => EdgeType | void | false | null;
export type OnBeforeDelete<
NodeType extends Node = Node,
EdgeType extends Edge = Edge