-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
There appears to be a typing bug with the return values from async functions, perhaps limited to tuples. Examples:
// Works!
function test(): [boolean, number] {
return [true, 1];
}
// Works!
function test2(): Promise<[boolean, number]> {
return Promise.resolve([true, 1]);
}
// Doesn't work
async function test3(): Promise<[boolean, number]> {
return [true, 1]; // Error here!
}The error is:
Type '(boolean | number)[]' is not assignable to type '[boolean, number]'.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue