Type 'Map<string, any>' is not an array type or a string type?

typescript, typescript2.0

Solution

You have to add `downlevelIteration` to compilerOptions:

"compilerOptions": {
  "target": "es5",
  "module": "es2015",
  "moduleResolution": "node",
  "lib": [ "DOM", "ES2015" ],
  "downlevelIteration": true,
  ...
},

Problem

Adding lib "ES2015" or higher solves every other type issue for typescript compilation with target ES5, but Map just doesn't want to work. How can this issue be solved?

Original source