-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.d.ts
26 lines (22 loc) · 797 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
declare module 'ngraph.fromjson' {
import { Graph, NodeId } from 'ngraph.graph';
import { EventedType } from 'ngraph.events';
export interface JsonLink<Data = any> {
fromId: NodeId;
toId: NodeId;
data?: Data;
}
export interface JsonNode<Data = any> {
id: NodeId;
data?: Data;
}
export interface JsonGraph<Node = JsonNode<any>, Link = JsonLink<any>> {
nodes: Node[];
links: Link[];
}
export default function load<NodeData = any, LinkData = any, Node = JsonNode<NodeData>, Link = JsonLink<LinkData>>(
jsonGraph: JsonGraph<JsonNode<NodeData> | Node, JsonLink<LinkData> | Link> | string,
nodeTransform?: (node: Node) => JsonNode<NodeData>,
linkTransform?: (link: Link) => JsonLink<LinkData>
): Graph<NodeData, LinkData> & EventedType;
}