chore(onbeforedelete): use correct node/edge types, pass generic
This commit is contained in:
@@ -142,7 +142,7 @@ export type ColorMode = ColorModeClass | 'system';
|
||||
|
||||
export type ConnectionLookup = Map<string, Map<string, Connection>>;
|
||||
|
||||
export type OnBeforeDelete = <NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>({
|
||||
export type OnBeforeDeleteBase<NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase> = ({
|
||||
nodes,
|
||||
edges,
|
||||
}: {
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
NodeDragItem,
|
||||
CoordinateExtent,
|
||||
OnError,
|
||||
OnBeforeDelete,
|
||||
OnBeforeDeleteBase,
|
||||
} from '../types';
|
||||
import { errorMessages } from '../constants';
|
||||
|
||||
@@ -347,7 +347,7 @@ export async function getElementsToRemove<NodeType extends NodeBase = NodeBase,
|
||||
edgesToRemove: Partial<EdgeType>[];
|
||||
nodes: NodeType[];
|
||||
edges: EdgeType[];
|
||||
onBeforeDelete?: OnBeforeDelete;
|
||||
onBeforeDelete?: OnBeforeDeleteBase<NodeType, EdgeType>;
|
||||
}): Promise<{
|
||||
nodes: NodeType[];
|
||||
edges: EdgeType[];
|
||||
|
||||
Reference in New Issue
Block a user