chore(onbeforedelete): use correct node/edge types, pass generic
This commit is contained in:
@@ -23,7 +23,6 @@ import {
|
||||
type OnConnectStart,
|
||||
type OnConnectEnd,
|
||||
type NodeLookup,
|
||||
type OnBeforeDelete,
|
||||
type EdgeLookup
|
||||
} from '@xyflow/system';
|
||||
|
||||
@@ -47,7 +46,8 @@ import type {
|
||||
Edge,
|
||||
FitViewOptions,
|
||||
OnDelete,
|
||||
OnEdgeCreate
|
||||
OnEdgeCreate,
|
||||
OnBeforeDelete
|
||||
} from '$lib/types';
|
||||
import { createNodesStore, createEdgesStore } from './utils';
|
||||
import { initConnectionProps, type ConnectionProps } from './derived-connection-props';
|
||||
|
||||
@@ -5,7 +5,8 @@ import type {
|
||||
Position,
|
||||
XYPosition,
|
||||
ConnectingHandle,
|
||||
Connection
|
||||
Connection,
|
||||
OnBeforeDeleteBase
|
||||
} from '@xyflow/system';
|
||||
|
||||
import type { Node } from './nodes';
|
||||
@@ -52,3 +53,7 @@ export type FitViewOptions = FitViewOptionsBase<Node>;
|
||||
|
||||
export type OnDelete = (params: { nodes: Node[]; edges: Edge[] }) => void;
|
||||
export type OnEdgeCreate = (connection: Connection) => Edge | Connection | void;
|
||||
export type OnBeforeDelete<
|
||||
NodeType extends Node = Node,
|
||||
EdgeType extends Edge = Edge
|
||||
> = OnBeforeDeleteBase<NodeType, EdgeType>;
|
||||
|
||||
Reference in New Issue
Block a user