From 25edd01a1cd3847c9b62a4036a30bfcaec9c2df0 Mon Sep 17 00:00:00 2001 From: Prokop Simek Date: Mon, 5 Aug 2019 19:16:05 +0200 Subject: [PATCH] feat(toposort): second element of array can be undefined (#37104) --- types/toposort/index.d.ts | 3 ++- types/toposort/toposort-tests.ts | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/types/toposort/index.d.ts b/types/toposort/index.d.ts index c2c9940c3a..ed94597140 100644 --- a/types/toposort/index.d.ts +++ b/types/toposort/index.d.ts @@ -1,7 +1,8 @@ // Type definitions for toposort 2.0 // Project: https://github.com/marcelklehr/toposort // Definitions by: Daniel Byrne +// Prokop Simek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function toposort(graph: ReadonlyArray<[string, string]>): ReadonlyArray; +declare function toposort(graph: Array<[string, string | undefined]>): string[]; export = toposort; diff --git a/types/toposort/toposort-tests.ts b/types/toposort/toposort-tests.ts index 84f554033b..9dcd4fa10d 100644 --- a/types/toposort/toposort-tests.ts +++ b/types/toposort/toposort-tests.ts @@ -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 +// $ExpectType string[] toposort(testGraph);