1

Used all the below references but still in VS 2015 I'm getting below errors

Cannot find name Promise and Property 'toPromise' does not exist on type 'Observable'

Use Below Imports

import {Http, Headers, Response} from '@angular/http'; import 'rxjs/add/operator/toPromise';

sudhir
  • 1,387
  • 3
  • 25
  • 43

1 Answers1

2

I use Visual Studio 2015 update 3 and had the same problem. I changed file

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TypeScript\typescriptServices.js

with the file from

and my problem went away.

enter image description here Maybe it helps you too

yurzui
  • 205,937
  • 32
  • 433
  • 399
  • Thanks man , Thanks alot..! Awesome , but do we hav eany alternative other than this ? because modifying file is not suggested one . Can you provide any official reference or site for the proposed solution?? and I still See Cannot Find Promise error (only toPromise is resolved) – sudhir Oct 05 '16 at 07:09
  • Try to open this project https://github.com/alexzuza/angular2-typescript-systemjs in visual studio. Maybe you forgot to configurate typings http://www.ryadel.com/en/visual-studio-2015-fix-typescript-ts2304-compilation-errors/ Check also this thread http://stackoverflow.com/questions/36178790/build-cannot-find-name-promise-visual-studio-2015-w-mvc6-and-angular-2 – yurzui Oct 05 '16 at 09:14