Error: Typescript Feature 1.5. Current language level is 1.4

TypescriptVisual Studio-2015

Typescript Problem Overview


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)?

Typescript Solutions


Solution 1 - Typescript

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.

Solution 2 - Typescript

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

Solution 3 - Typescript

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 https://stackoverflow.com/questions/24034668/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"

Solution 4 - Typescript

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."

Solution 5 - Typescript

VS 2019, click Extensions->search for Typescript 3.8 for VS, click to install, restart VS, the the VS/ReSharper will recognize the feature of Typescript 3.8. in project file Latest using "Latest" is a smart way.

Solution 6 - Typescript

Make sure you set the proper version in your project XML. See the node below:

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
  <TypeScriptTarget>ES6</TypeScriptTarget>
  <TypeScriptJSXEmit>None</TypeScriptJSXEmit>
  <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
  <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
  <TypeScriptModuleKind>CommonJS</TypeScriptModuleKind>
  <TypeScriptRemoveComments>False</TypeScriptRemoveComments>
  <TypeScriptOutFile />
  <TypeScriptOutDir />
  <TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
  <TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
  <TypeScriptSourceMap>True</TypeScriptSourceMap>
  <TypeScriptMapRoot />
  <TypeScriptSourceRoot>~/app/</TypeScriptSourceRoot>
  <TypeScriptExperimentalDecorators>True</TypeScriptExperimentalDecorators>
</PropertyGroup>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionbrandoView Question on Stackoverflow
Solution 1 - Typescriptadrian h.View Answer on Stackoverflow
Solution 2 - TypescriptbrandoView Answer on Stackoverflow
Solution 3 - TypescriptJimiSwedenView Answer on Stackoverflow
Solution 4 - TypescriptProfKView Answer on Stackoverflow
Solution 5 - TypescriptAlison NiuView Answer on Stackoverflow
Solution 6 - TypescriptStephen BakerView Answer on Stackoverflow