mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-28 09:25:50 +08:00
Merge pull request #15694 from michaelgerakis/master
@types/graphlib -- parent should be an optional parameter in setParent
This commit is contained in:
@@ -23,6 +23,7 @@ function test_graph() {
|
||||
g.setDefaultEdgeLabel(() => 'e42');
|
||||
g.setNodes(['a', 'b', 'c'], 42);
|
||||
g.setParent('d', 'a');
|
||||
g.setParent('d');
|
||||
g.parent('d');
|
||||
g.children('a');
|
||||
g.filterNodes(v => true);
|
||||
|
||||
5
types/graphlib/index.d.ts
vendored
5
types/graphlib/index.d.ts
vendored
@@ -65,7 +65,8 @@ declare module "graphlib" {
|
||||
setNodes(names: string[], label?: any): Graph;
|
||||
|
||||
/**
|
||||
* Sets node p as a parent for node v. Method throws an exception in case of
|
||||
* Sets node p as a parent for node v if it is defined, or removes the
|
||||
* parent for v if p is undefined. Method throws an exception in case of
|
||||
* invoking it in context of noncompound graph.
|
||||
* Average-case complexity: O(1).
|
||||
*
|
||||
@@ -73,7 +74,7 @@ declare module "graphlib" {
|
||||
* @argument p - node to be parent for v.
|
||||
* @returns the graph, allowing this to be chained with other functions.
|
||||
*/
|
||||
setParent(v: string, p: string): Graph;
|
||||
setParent(v: string, p?: string): Graph;
|
||||
|
||||
/**
|
||||
* Gets parent node for node v.
|
||||
|
||||
Reference in New Issue
Block a user