File tree 2 files changed +6
-6
lines changed
packages/core/src/composables 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
- import type { CustomEvent , ElementData } from '~/types'
1
+ import type { GraphEdge } from '~/types'
2
2
import { VueFlowError } from '~/utils/errors'
3
3
4
4
/**
@@ -8,13 +8,13 @@ import { VueFlowError } from '~/utils/errors'
8
8
*
9
9
* Meaning if you do not provide an id, this composable has to be called in a child of your custom edge component, or it will throw
10
10
*/
11
- export default function useEdge < Data = ElementData , CustomEvents extends Record < string , CustomEvent > = any > ( id ?: string ) {
11
+ export default function useEdge < T extends GraphEdge = GraphEdge > ( id ?: string ) {
12
12
const edgeId = id ?? inject ( EdgeId , '' )
13
13
const edgeEl = inject ( EdgeRef , null )
14
14
15
15
const { findEdge, emits } = useVueFlow ( )
16
16
17
- const edge = findEdge < Data , CustomEvents > ( edgeId )
17
+ const edge = findEdge < T > ( edgeId )
18
18
19
19
if ( ! edge ) {
20
20
emits . error ( new VueFlowError ( ErrorCode . EDGE_NOT_FOUND , edgeId ) )
Original file line number Diff line number Diff line change 1
- import type { CustomEvent , ElementData } from '~/types'
1
+ import type { GraphNode } from '~/types'
2
2
3
3
/**
4
4
* Access a node, it's parent (if one exists) and connected edges
@@ -7,13 +7,13 @@ import type { CustomEvent, ElementData } from '~/types'
7
7
*
8
8
* Meaning if you do not provide an id, this composable has to be called in a child of your custom node component, or it will throw
9
9
*/
10
- export default function useNode < Data = ElementData , CustomEvents extends Record < string , CustomEvent > = any > ( id ?: string ) {
10
+ export default function useNode < T extends GraphNode = GraphNode > ( id ?: string ) {
11
11
const nodeId = id ?? inject ( NodeId , '' )
12
12
const nodeEl = inject ( NodeRef , null )
13
13
14
14
const { findNode, getEdges, emits } = useVueFlow ( )
15
15
16
- const node = findNode < Data , CustomEvents > ( nodeId ) !
16
+ const node = findNode < T > ( nodeId ) !
17
17
18
18
if ( ! node ) {
19
19
emits . error ( new VueFlowError ( ErrorCode . NODE_NOT_FOUND , nodeId ) )
You can’t perform that action at this time.
0 commit comments