diff --git a/types/graphviz/graphviz-tests.ts b/types/graphviz/graphviz-tests.ts index 05d4c599bc0e47..d796b0bf8aa1c2 100644 --- a/types/graphviz/graphviz-tests.ts +++ b/types/graphviz/graphviz-tests.ts @@ -10,6 +10,9 @@ n1.set("style", "filled"); // Add node (ID: World) g.addNode("World"); +const g_h: graphviz.Node = g.getNode("Hello"); +g_h.set("shape", "star"); + // Add edge between the two nodes const e: graphviz.Edge = g.addEdge(n1, "World"); e.set("color", "red"); diff --git a/types/graphviz/index.d.ts b/types/graphviz/index.d.ts index d6cc1ba5c68213..9b7c52b869b082 100644 --- a/types/graphviz/index.d.ts +++ b/types/graphviz/index.d.ts @@ -2,8 +2,11 @@ // Project: https://github.com/glejeune/node-graphviz // Definitions by: Matt Frantz , // Kamontat Chantrachirathumrong +// Kirill Ivanov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + export type PossibleValue = string | number | boolean; export type RenderType = string; @@ -27,7 +30,7 @@ export interface Node extends HasAttributes { export interface Edge extends HasAttributes {} export interface OutputCallback { - (data: string): void; + (data: Buffer): void; } export interface ErrorCallback { @@ -72,6 +75,7 @@ export interface Graph extends HasAttributes { use: RenderEngine; addNode(id: string, attrs?: any): Node; + getNode(id: string): Node; nodeCount(): number; addEdge(nodeOne: string | Node, nodeTwo: string | Node, attrs?: Options): Edge;