有人知道如何在 VS2017 中使用 Aurelia.js 时摆脱此消息吗?
我使用的是 VS2017,而不是 VSCode,我使用的是 Javascript,而不是每篇互联网文章似乎都相信的 Typescript...
我尝试取消选中“启用新的 JavaScript 语言服务”选项,但它没有帮助(我也想继续使用新的 JS 语言服务!)。
我还尝试将 EsLint 选项设置为 false,但这也无济于事!有什么建议吗?
最佳答案
您需要将 experimentalDecorators
标志设置为 true
的 tsconfig.json
。
这是因为技术装饰器还没有被 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
}
}
如果这会导致任何其他问题,请告诉我。
关于javascript - Visual Studio 2017 Javascript 如何设置 'experimentaldecorators',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42853086/