Visual Studio 2017 Javascript如何设置'experimentaldecorators' [英] Visual Studio 2017 Javascript How to set 'experimentaldecorators'
问题描述
任何人都知道在VS2017中使用Aurelia.js时如何摆脱此消息?
Anyone knows how to get rid of this message when using Aurelia.js in VS2017??
我正在使用VS2017,而不是VSCode,并且我正在使用Javascript,而不是Typescript,因为每篇互联网文章似乎都相信...
I'm using VS2017, not VSCode, and I'm using Javascript, not Typescript as every internet article seems to believe...
我尝试取消选中启用新的JavaScript语言服务"选项,但没有帮助(我也想继续使用新的JS语言服务!).
I tried unchecking the "Enable the new JavaScript language service" option, but it didn't help (and I also would like to keep using the new JS language service!).
我还尝试将EsLint选项设置为false,但这也无济于事!有什么建议吗?
I also tried setting the EsLint option to false, but that didn't help either! Any suggestions?
推荐答案
您需要将experimentalDecorators
标志设置为true
的tsconfig.json
.
You need a tsconfig.json
with the experimentalDecorators
flag set to true
.
这里的原因是因为技术装饰器尚未被ECMAScript接受(尽管它们在许多框架中得到了广泛采用).因此,此代码可能会在今天的版本中得到支持,而在下一发行版中可能会不受支持.由于存在这种风险,除非您在tsconfig文件中另行确认,否则我们会在您每次使用它们时提供警告.
The reason this is here is because technical decorators haven't been accepted into ECMAScript yet (despite their wide adoption amongst many frameworks). As such its possible that this code that works today, might not be supported in the next release. Because of this risk we a supply a warning anytime you use them unless otherwise acknowledged in a tsconfig file.
可能为您服务的示例tsconfig.json
看起来像这样:
A sample tsconfig.json
that might serve you looks like this:
{
"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
}
}
让我知道是否会导致其他问题.
Let me know if that causes any additional problems.
这篇关于Visual Studio 2017 Javascript如何设置'experimentaldecorators'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!