extend onBeforeConnect type to allow void & null & false
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user