From 033ff82d2b8cba51b3d1b69c5ded1cf46bb610fa Mon Sep 17 00:00:00 2001 From: koorya Date: Sun, 19 Sep 2021 11:04:15 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#55829=20fix=20type?= =?UTF-8?q?s=20graphviz=20by=20@koorya?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix types graphviz * fix type reference. Buffer is recognised now * missing whitespace --- types/graphviz/graphviz-tests.ts | 3 +++ types/graphviz/index.d.ts | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) 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;