Skip to content

Promise.all not correctly inferring types. #34925

Closed
@afrieder

Description

@afrieder

TypeScript Version: 3.7.2, v3.8.0-dev.20191102

Search Terms:
Promise.all
Wrong type

Code

const f1 = async (): Promise<string> => {
    return '';
};

const f2 = async (): Promise<number> => {
    return 0;
};

const f3 = async (): Promise<Object> => {
    return {};
};

const res = Promise.all([f1(), f2(), f3()]);

Expected behavior:
res has type Promise<[string, number, Object]>.

Actual behavior:
res has type Promise<Object[]>.

Playground Link:
http://www.typescriptlang.org/play/?ts=3.8.0-dev.20191102&ssl=2&ssc=1&pln=5&pc=1#code/MYewdgzgLgBAZgRhgXhgQwgTzMGAKASgC4YAFAJxAFsBLCAUwB5pyawBzAPhW4G8AoGEJjl6UAK7kwMAOQyA3PwC+-fqEiw4AJhTosOfMTKVaDRmHFUARvXLdkfQcNESpMAAyKVa8NHgBmXQxsXEISCmo6JgB5KwAremAoe0dhETFJaV4lL1V1P1EIXQjTegA6NAAbSrwAbURCABp4LSaAwgBdAnkgA

Related Issues:

Metadata

Metadata

Assignees

Labels

Needs InvestigationThis issue needs a team member to investigate its status.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions