Closed
Description
TypeScript Version: 3.0.1
Search Terms:
type, infer, bug, map, typings, array
Code
let a: Map<string, Map<string, any>>;
const arr = [
['outer1', [['inner11', {}], ['inner12', {}]]],
['outer2', [['inner21', {}], ['inner22', {}]]],
];
const arr2: Array<[string, Map<string, any>]> = arr.map(([out, a]) => [out, new Map(a)]);
a = new Map(arr2);
Expected behavior:
Typescript should use only the following type for parameter a
{}[][]
Actual behavior:
Typescript infer the type of parameter a to
string | {}[][]
Playground Link: