TypeScript: Duplicate identifier 'IteratorResult'

后端 未结 10 1836
无人共我
无人共我 2020-12-15 01:59

I\'m trying to compile via tsc--which I\'ve installed globally--and I\'m getting an error:

~/AppData/R         


        
10条回答
  •  执笔经年
    2020-12-15 03:00

    As @Muhammad bin Yusrat said in his comment, run npm i @types/node@latest (npm i @types/node doesn't work !!) if you have just updated angular to 9. That worked for me.

    It also got rid of another ionic 5 console error after running ionic serve-> 'refused to load image 'http:localhost:8100/favicon.ico' because it violates the following Content Security Policy .....' (see below).

    Another 'IteratorResult' error was caused by "Spread Types" Error. See Typescript: Spread types may only be created from object types. Basically somewhere in your code you have used a spread operator like this return { id: doc.payload.id, ...doc.payload.data() }; and you have to change it to this return { id: doc.payload.id, ...doc.payload.data() as {} }; ie add as {}

提交回复
热议问题