File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
packages/core/src/composables Expand file tree Collapse file tree 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'
22import { VueFlowError } from '~/utils/errors'
33
44/**
@@ -8,13 +8,13 @@ import { VueFlowError } from '~/utils/errors'
88 *
99 * 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
1010 */
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 ) {
1212 const edgeId = id ?? inject ( EdgeId , '' )
1313 const edgeEl = inject ( EdgeRef , null )
1414
1515 const { findEdge, emits } = useVueFlow ( )
1616
17- const edge = findEdge < Data , CustomEvents > ( edgeId )
17+ const edge = findEdge < T > ( edgeId )
1818
1919 if ( ! edge ) {
2020 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'
22
33/**
44 * Access a node, it's parent (if one exists) and connected edges
@@ -7,13 +7,13 @@ import type { CustomEvent, ElementData } from '~/types'
77 *
88 * 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
99 */
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 ) {
1111 const nodeId = id ?? inject ( NodeId , '' )
1212 const nodeEl = inject ( NodeRef , null )
1313
1414 const { findNode, getEdges, emits } = useVueFlow ( )
1515
16- const node = findNode < Data , CustomEvents > ( nodeId ) !
16+ const node = findNode < T > ( nodeId ) !
1717
1818 if ( ! node ) {
1919 emits . error ( new VueFlowError ( ErrorCode . NODE_NOT_FOUND , nodeId ) )
You can’t perform that action at this time.
0 commit comments