繁体   English   中英

Visual Studio 2017 Javascript如何设置'experimentaldecorators'

[英]Visual Studio 2017 Javascript How to set 'experimentaldecorators'

任何人都知道如何在VS2017中使用Aurelia.js时摆脱这条消息? 在此输入图像描述

我正在使用VS2017,而不是VSCode,我正在使用Javascript,而不是每个互联网文章似乎相信的Typescript ......

我尝试取消选中“启用新的JavaScript语言服务”选项,但它没有帮助(我也想继续使用新的JS语言服务!)。

我也尝试将EsLint选项设置为false,但这也没有帮助! 有什么建议?

你需要一个tsconfig.json ,将experimentalDecorators标志设置为true

这是因为技术装饰器尚未被ECMAScript接受(尽管它们在许多框架中被广泛采用)。 因此,今天可能运行的代码可能在下一版本中不受支持。 由于存在这种风险,我们会在您使用它们时随时提供警告,除非在tsconfig文件中另行确认。

可能为您提供服务的示例tsconfig.json如下所示:

{
  "compilerOptions": {
    "experimentalDecorators": true, //silences the error
    "allowJs": true, // includes .js files (not just .ts)
    "noEmit": true
  },
  "exclude": [
    "node_modules" //exclude large folders with libs from project (it'll be faster)
  ],
  "typeAcquisition": {
    "enable": true  // helps fuel better js intellisense
  }
}

如果这会导致任何其他问题,请告诉我。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM