node_modules/@types/jasmine/index.d.ts: error TS1005: '=' expected

匿名 (未验证) 提交于 2019-12-03 01:22:02

问题:

Earlier I was working with Angular2.3.1 and just updated package.json file using npm update --save to get updated version of Angular2 which is 2.4.7.

But it seems, for some reason, its breaking the code when I do npm start.

Its says

node_modules/@types/jasmine/index.d.ts(39,52): error TS1005: '=' expected

Now, I wonder how to fix it?

Any idea?

回答1:

After searching in google, came to know that latest version 2.5.43 of @types/jasmine is not compatible with typescript version 2.0.*.

So had to upgrade typescript to 2.1.6.

Read more here: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/14569



回答2:

As mentioned on Github you should downgrade your jasmine version for now.

In you package.json replace the current dependency with:

"@types/jasmine": "2.5.38" 

After that run and NPM update in you command line

$ npm update 

That's it your done, compilation errors should disappear.



回答3:

Make sure local TypeScript version is "2.1.6". In my case global TypeScript version was 2.2.1 and local version was 2.0.3. I changed local version for TypeScript (in package.json) to "2.1.6" and it worked fine.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!