问题
Anyone knows how to get rid of this message when using Aurelia.js in VS2017??
I'm using VS2017, not VSCode, and I'm using Javascript, not Typescript as every internet article seems to believe...
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!).
I also tried setting the EsLint option to false, but that didn't help either! Any suggestions?
回答1:
You need a tsconfig.json
with the experimentalDecorators
flag set to true
.
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.
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.
来源:https://stackoverflow.com/questions/42853086/visual-studio-2017-javascript-how-to-set-experimentaldecorators