Skip to content

Commit 8c57ecc

Browse files
authored
🤖 Merge PR DefinitelyTyped#73114 Correct a few function types in dagre by @cromo-rxt
1 parent cd82d63 commit 8c57ecc

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

types/dagre/dagre-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ dagre.graphlib.alg.components(gDagre);
4444
dagre.graphlib.alg.dijkstra(gDagre, "a", edge => 5);
4545
dagre.graphlib.alg.dijkstraAll(gDagre);
4646
dagre.graphlib.alg.findCycles(gDagre);
47-
dagre.graphlib.alg.floydWarchall(gDagre);
47+
dagre.graphlib.alg.floydWarshall(gDagre);
4848
dagre.graphlib.alg.isAcyclic(gDagre);
4949
dagre.graphlib.alg.postorder(gDagre, "a");
5050
dagre.graphlib.alg.preorder(gDagre, ["b", "c"]);

types/dagre/index.d.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export namespace graphlib {
3737
setDefaultNodeLabel(callback: string | ((nodeId: string) => string | Label)): Graph<T>;
3838
setNode(name: string, label: string | Label): Graph<T>;
3939
setParent(childName: string, parentName: string): void;
40-
sinks(): Array<Node<T>>;
41-
sources(): Array<Node<T>>;
40+
sinks(): string[];
41+
sources(): string[];
4242
successors(name: string): Array<Node<T>> | undefined;
4343
}
4444

@@ -49,10 +49,23 @@ export namespace graphlib {
4949

5050
namespace alg {
5151
function components(graph: Graph): string[][];
52-
function dijkstra(graph: Graph, source: string, weightFn?: WeightFn, edgeFn?: EdgeFn): any;
53-
function dijkstraAll(graph: Graph, weightFn?: WeightFn, edgeFn?: EdgeFn): any;
52+
function dijkstra(
53+
graph: Graph,
54+
source: string,
55+
weightFn?: WeightFn,
56+
edgeFn?: EdgeFn,
57+
): Record<string, { distance: number; predecessor?: string }>;
58+
function dijkstraAll(
59+
graph: Graph,
60+
weightFn?: WeightFn,
61+
edgeFn?: EdgeFn,
62+
): Record<string, Record<string, { distance: number; predecessor?: string }>>;
5463
function findCycles(graph: Graph): string[][];
55-
function floydWarchall(graph: Graph, weightFn?: WeightFn, edgeFn?: EdgeFn): any;
64+
function floydWarshall(
65+
graph: Graph,
66+
weightFn?: WeightFn,
67+
edgeFn?: EdgeFn,
68+
): Record<string, Record<string, { distance: number; predecessor?: string }>>;
5669
function isAcyclic(graph: Graph): boolean;
5770
function postorder(graph: Graph, nodeNames: string | string[]): string[];
5871
function preorder(graph: Graph, nodeNames: string | string[]): string[];

0 commit comments

Comments
 (0)