feat(core): export isGraphNode & isGraphEdge typeguards

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-02-01 23:00:08 +01:00
committed by Braks
parent 539b85dc59
commit 6ea60349fd
2 changed files with 4 additions and 1 deletions
+2
View File
@@ -32,6 +32,8 @@ export {
export {
isNode,
isEdge,
isGraphNode,
isGraphEdge,
addEdge,
updateEdge,
getOutgoers,
+2 -1
View File
@@ -8,6 +8,7 @@ import type {
Dimensions,
Edge,
EdgeMarkerType,
Element,
ElementData,
Elements,
FlowElement,
@@ -53,7 +54,7 @@ export const getHostForElement = (element: HTMLElement): Document => {
else return window.document
}
type MaybeElement = Node | Edge | Connection | FlowElement
type MaybeElement = Node | Edge | Connection | FlowElement | Element
export const isEdge = <Data = ElementData>(element: MaybeElement): element is Edge<Data> =>
element && 'id' in element && 'source' in element && 'target' in element