Reputation: 1297
I am using Angular2 with Visual studio code. In visual studio code It shows me error as shown below :
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 ?
Upvotes: 9
Views: 3005
Reputation: 329
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.
Upvotes: 1
Reputation: 8047
One solution is to install the typings of es6-shim
.
First install typings with:
npm install typings --global
Install the es6-shim
typings with:
typings install es6-shim --save
You should have a typings folder now, with es6-shim.d.ts
.
If you don't have a jsconfig.json
file you will need to reference those typings by placing this on the top of your file:
/// <reference path='./path/to/typings' />
Upvotes: 1