-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
TypeScript Version: 3.1.3
Search Terms:
Promise.all, optional elements in tuple types
Code
// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
const arr: [Promise<number>, Promise<string>?] = [
Promise.resolve(1)
];
arr[1] = Promise.resolve('1');
Promise.all(arr); // Error
// or
const arr2: Array<Promise<number> | Promise<string>> = [Promise.resolve(1)];
arr2.push(Promise.resolve('1'));
Promise.all(arr2); // Error
Expected behavior:
Promise.all(arr)
should be correct
Actual behavior:
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptThe issue relates to the different libraries shipped with TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue