Skip to content

4.0: Cannot use variadic tuples in Promise.all #39788

Closed

Description

TypeScript Version: 4.0.0-beta

Search Terms:

variadic tuples promise.all

Code

declare const foo: Promise<string>;
declare const bar: Promise<number>[];

async function m() {
    const p = await Promise.all([
        foo,
        ...bar
    ])
}

Expected behavior:

p should have type [string, ...number]

Actual behavior:

Type error

Playground Link: https://www.typescriptlang.org/play/?ts=4.0.0-dev.20200728&ssl=9&ssc=2&pln=1&pc=1#code/CYUwxgNghgTiAEYD2A7AzgF3gMyUgXPAAoxIC2AlmiADyYwUoDmAfANwCwAUKJLAsnRYARrEIlyVWigCuZYSBgsA2gF1OXblDQBPFGBwz9GCqnhkAFAEp4Ab27xHiVJngAHeAF54UAO5QKLAlKagA6KAgIC2UHJzjcJAAaWLjHUPTRGBT4VStuAF8gA

Related Issues: none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions