mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
feat(toposort): second element of array can be undefined (#37104)
This commit is contained in:
parent
f4343f992b
commit
25edd01a1c
3
types/toposort/index.d.ts
vendored
3
types/toposort/index.d.ts
vendored
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user