Error: Typescript Feature 1.5. Current language level is 1.4

后端 未结 6 1513
不知归路
不知归路 2021-02-04 23:08

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

相关标签:
6条回答
  • 2021-02-04 23:21

    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"

    0 讨论(0)
  • 2021-02-04 23:28

    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:

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

    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

    0 讨论(0)
  • 2021-02-04 23:29

    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>
    
    0 讨论(0)
  • 2021-02-04 23:38

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

    0 讨论(0)
  • 2021-02-04 23:45

    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.

    0 讨论(0)
  • 2021-02-04 23:46

    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.

    0 讨论(0)
提交回复
热议问题