Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Typescript Feature 1.5. Current language level is 1.4

I am working in the context of Visual Studio 2015 (with Resharper), and am referencing a TypeScript definitions file for NodeJS. I have 3 other VS projects that are using node.d.ts without problems. In this new project, however, I now have 146 errors saying the same thing:

"Typescript Feature 1.5. Current language level is 1.4".

For the life of me, I can't figure out how to tell Visual Studio (or Resharper?) to use the latest TypeScript language version.

I've tried: Tools > Options > Typescript > Project > General > ECMAScript6 (selected) and it didn't work.

Also:

npm install -g typescript

and it didn't work as well.

How do I tell VS to use Typescript 1.5.3 (which node.d.td is asking for)?

like image 858
brando Avatar asked Aug 28 '15 18:08

brando


4 Answers

It's a ReSharper setting. From the menu bar in Visual Studio, click ResharperOptionsCode EditingTypeScriptInspections, then change the TypeScript language level to the relevant value.

like image 163
adrian h. Avatar answered Nov 18 '22 12:11

adrian h.


I found out how to fix this. First, if you are using Resharper, as others have mentioned, you need to indicate the version of typescript you are using:

enter image description here

However, within Visual Studio you need to go to Tools/Extensions and Updates and upgrade the Typescript extension to the latest version.
enter image description here

Do this by searching for "typescript" under the "installed" tab. In the yellow box I highlighted you should see a message saying that any available updates are available under the "Updates" tab. Go to the "Updates" tab and update your typescript extension to the latest version. (I had already made the update so no update selection is now available to me for Typescript).

UPDATE:
It is simplest to go to download and install "Typescript for Visual Studio" to get the latest version: https://www.microsoft.com/en-us/download/details.aspx?id=48593

like image 37
brando Avatar answered Nov 18 '22 10:11

brando


A little bit off topic but since I found this thread when looking for a solution on the error "ECMAScript 6 feature. Your current language level is: ECMAScript 5"...

I want to add a note on Antons comment about ES6 and Resharper 10.

If you get the error "ECMAScript 6 feature. Your current language level is: ECMAScript 5" it is possible to change the level in Resharper 9.1 as stated in this post How to use ECMAScript 6 syntax with Visual Studio 2013

I´m running 9.2 now and just did this. Resharper Options > Javascript > Inspections > "change Javascript language level to ES6"

like image 9
JimiSweden Avatar answered Nov 18 '22 10:11

JimiSweden


There is now a TypeScript 1.5 for Visual Studio 2015. Get it at https://blogs.msdn.microsoft.com/typescript/2015/07/20/announcing-typescript-1-5/

It's actually for VS 2013, but they imply strongly it will work with 2015 as well: "TypeScript 1.5 is part of the newly released Visual Studio 2015."

like image 1
ProfK Avatar answered Nov 18 '22 11:11

ProfK