Skip to content

map() type inference incomplete #19868

Closed
Closed
@ithinkihaveacat

Description

@ithinkihaveacat

Code

const foo = [1, 2, 3].map(() => [1, 2]);
const bar = new Map<number, number>(foo)

Expected behavior:

No error.

Actual behavior:

Type error: Argument of type 'number[][]' is not assignable to parameter of type '[number, number][]'. In this case, foo will always be of the form [number, number][].

screenshot from 2017-11-09 11 23 36

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions