fix(core): correct isDef typeguard
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,11 @@
|
|||||||
import type { Actions, Connection, Edge, GraphEdge, GraphNode, Node, State } from '~/types'
|
import type { Actions, Connection, Edge, GraphEdge, GraphNode, Node, State } from '~/types'
|
||||||
|
|
||||||
export function isDef<T>(val: T): val is NonNullable<T> {
|
type NonUndefined<T> = T extends undefined ? never : T
|
||||||
return typeof unref(val) !== 'undefined'
|
|
||||||
|
export function isDef<T>(val: T): val is NonUndefined<T> {
|
||||||
|
const unrefVal = unref(val)
|
||||||
|
|
||||||
|
return typeof unrefVal !== 'undefined' && unrefVal !== null
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addEdgeToStore(edgeParams: Edge | Connection, edges: Edge[], onError: State['hooks']['error']['trigger']) {
|
export function addEdgeToStore(edgeParams: Edge | Connection, edges: Edge[], onError: State['hooks']['error']['trigger']) {
|
||||||
|
|||||||
Reference in New Issue
Block a user