1

I'm having issues with my Angular project. It was developed without Angular CLI and now I'm getting these errors, as it appears it can't find classes inside collection.d.ts:

Build:Cannot find name 'Map'.
Build:Cannot find name 'MapConstructor'.

and so on. My tsconfig.json is the following:

{
"compilerOptions": {
    "target": "es2015",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false,
    "outDir": "build/",
    "skipLibCheck": true,
    "lib": [ "es6","dom" ]
},
"compileOnSave": true]
}

I've already searched online for a solution, targeting es6, es5, or adding other lib attributes. Solutions? Thanks

  • May you provide the entire stack trace please? perhaps the problem is not related to **that** tsconfig specifically. Sounds quite related to this though: https://stackoverflow.com/questions/35660498/angular-cant-find-promise-map-set-and-iterator – briosheje Apr 04 '18 at 11:31
  • 1
    In my case the map operator was a rxjs operator, and with RxJS 6, I have to import it manually with: import { map } from 'rxjs/operators'; – Nammen8 Mar 02 '20 at 10:35

1 Answers1

3

Try this combination : "target": "es5", "lib": ["es5", "es6", "es7", "DOM"],

If that doesn't work try npm install --save-dev @types/core-js.

Which Angular and CLI version are you running exactly ?

DrNio
  • 1,936
  • 1
  • 19
  • 25