TypeScript Version: 2.0.3
Code
The map callback in the code below is the identity function.
letarr: Array<[number,number]>=[[1,2]]letmappedArr: 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[]'.
TypeScript playground link
TypeScript Version: 2.0.3
Code
The
mapcallback in the code below is the identity function.Expected behavior:
mappedArris of typeArray<[number, number]>. Compilation works.Actual behavior: Doesn't work. Error message:
TypeScript playground link