Closed
Description
TypeScript Version: 2.1.6
Code
const findByGroup = (key: string) => {
return otherObj.filter(obj => obj.Name === key)
}
// expected return type to be: [[string, any[]]] but type checker shows [(string|any)[][]]
// this is evaluated correctly at runtime
const groupData = groups
.map(group => group.Name)
.map(name => [name, findByGroup(name)]);
// force type checker
const map = new Map<string, any[]>(groupData as [[string, any[]]]); // works
Expected behavior:
groupData
should return [[string, any[]]]
Actual behavior:
groupData
returns [(string|any)[][]]