Angular 2: Property 'toPromise' does not exist on type 'Observable<Response>'

别等时光非礼了梦想. 提交于 2019-12-01 00:19:54
Elena Orel

Please check out : Angular 2 2.0.0-rc.1 Property 'map' does not exist on type 'Observable<Response>' not the same as issue report

"For VS 2015 (Update 3):

Install VS 2015 Update 3 Replace C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\typescriptServices.js with the file in https://raw.githubusercontent.com/Microsoft/TypeScript/Fix8518-U3/lib/typescriptServices.js. First take a local backup though."

This workaround fixed the "Property 'toPromise' does not exist " issue for me.

I think this is a bug in Visual Studio (I'm guessing you're seeing this behavior in VS2015?) I have exactly this issue when I try working with an Angular2 app in VS2015.

As a work around you might try working with your project using Visual Studio Code instead. I opened your referenced repository using VS Code and verified it had intellisense for rxjs extensions (like toPromise) as expected. However, as you sate, in VS2015 rxjs extensions are not being found and show as errors.

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