Closed
Description
TypeScript Version: 2.0.3
Code
The map
callback in the code below is the identity function.
let arr: Array<[number, number]> = [[1, 2]]
let mappedArr: Array<[number, number]> = arr.map(([x, y]) => {
return [x, y];
})
Expected behavior: mappedArr
is of type Array<[number, number]>
. Compilation works.
Actual behavior: Doesn't work. Error message:
Type 'number[][]' is not assignable to type '[number, number][]'.
Type 'number[]' is not assignable to type '[number, number]'.
Property '0' is missing in type 'number[]'.