I have an angular2 CLI project.
Two days ago, because my Webstorm IDE complained about new Promise and string[].map could not been resolved, i forcefully installed es6-promise
inside node_modules/@types
folder using:
npm install @types/es6-promise --save
You can find the related question here: TypeScript complaining that array.map is not present on array of type string[]
Webstorm IDE finally worked as expected, no red underlined files , but today when I reloaded the app in the browser, I got this 6 errors:
I would say that the message error is pretty straight forward. The newly installed types in index.d.ts
file from @types
folder, are colliding with the ones form node_module/typescript
- the main module of typescript compiler - which Angular2 CLI created and is using by default.
Essentially: declarations like: "declare class Promise<T> etc..
" inside @types/es6-promise/index.d.ts
are the same with the ones in typescript/lib/lib.es2015.promise.d.ts
.
Ouestion: how to get around this? What code is needed to eliminate this conflict?
As of now (2 October 2016) - if you do a fresh ng init
- in Webstorm IDE - you can't have let myPromise = new Promise()
or any other es6 operators
- without the file being marked with an error.
If you install stuff in @types on your own - you get this duplicate identifier error..
Not being presumptuous here, but I'm pretty sure it's not only me - just created a fresh ng2CLI project. Can't get around this. Can anyone confirm that this is happening on their end? I lost half a day trying to solve this nonsense. Any thoughts on this matter are highly appreciated:) Thanks.