@rimbu/graph
Version:
Immutable Graph data structures for TypeScript
15 lines (13 loc) • 405 B
text/typescript
import type {
Link,
ValuedLink,
VariantGraphBase,
VariantValuedGraphBase,
} from '@rimbu/graph/custom';
/**
* Utility type to determine if a graph has valued or unvalued links
* @typeparam G - a graph subtype
* @typeparam N - the graph's node type
*/
export type LinkType<G extends VariantGraphBase<any, any>, N> =
G extends VariantValuedGraphBase<N, infer V> ? ValuedLink<N, V> : Link<N>;