feat(toposort): second element of array can be undefined (#37104)

This commit is contained in:
Prokop Simek 2019-08-05 19:16:05 +02:00 committed by Nathan Shively-Sanders
parent f4343f992b
commit 25edd01a1c
2 changed files with 8 additions and 6 deletions

View File

@ -1,7 +1,8 @@
// Type definitions for toposort 2.0
// Project: https://github.com/marcelklehr/toposort
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
// Prokop Simek <https://github.com/prokopsimek>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function toposort(graph: ReadonlyArray<[string, string]>): ReadonlyArray<string>;
declare function toposort(graph: Array<[string, string | undefined]>): string[];
export = toposort;

View File

@ -1,10 +1,11 @@
import toposort = require('toposort');
const testGraph: ReadonlyArray<[string, string]> = [
["string1", "string2"],
["string2", "string3"],
["string3", "string1"]
const testGraph: Array<[string, string | undefined]> = [
['string1', 'string2'],
['string2', 'string3'],
['string3', 'string1'],
['string4', undefined],
];
// $ExpectType ReadonlyArray<string>
// $ExpectType string[]
toposort(testGraph);