Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find name 'Promise' in visual studio code

I am using Angular2 with Visual studio code. In visual studio code It shows me error as shown below :

enter image description here

As seen in the image Promise is highlighted with red underline. Also I have another query is if we define inline function then Visual studio code will also shows red underline below the name of function. Like response is shown with red underline in above image.

However my code works fine in browser. but in VS Code it shows me red underline.

I don't want any red underline in my code. Is it possible ? Can anyone help me to resolve this ?

like image 555
Hardipsinh Jadeja Avatar asked Jun 03 '16 14:06

Hardipsinh Jadeja


1 Answers

As the visual studio has functionality for visible intellisense for any language, you can just add the typings.json file in root level and add below code to it.

-- your typings.json

{
  "globalDependencies": {
    "angular-protractor": "registry:dt/angular-protractor#1.5.0+20160425143459"
  }
}

and just hit the below command in cmd to current working project directory (install typings globally(-g) if not installed on your machine).

typings install

So only in visual studio, you will get the intellisense and remove the error.

like image 99
Anavar Bharmal Avatar answered Oct 23 '22 14:10

Anavar Bharmal