angular - WebStorm 2016.3 fel: Experimentellt stöd för dekoratörer är en funktion som kan ändras i en framtida version
Hej, uppdaterade till senaste WebStorm och jag får nu detta fel:
Error:(52, 14) TS1219:Experimental support for decorators
is a feature that is subject to change in a future release.
Set the 'experimentalDecorators' option to remove this warning.
Men i min tsConfig är experimentalDecorators inställt på true:
{
"version": "1.5.0",
"compilerOptions": {
//...,
"experimentalDecorators": true, // <======== HERE
//...,
},
"files": [
//...
],
"exclude": [ "node_modules" ]
}
Svar #1
WS2016.3 tillämpar konfigurationsinställningar på en fil endast om filen ingår i avsnittet 'files' eller 'include' i tsconfig.json. [Mer information om tsconfig.json]
Så konfigurationen måste inkludera alla projektfiler (eller om du har flera delar av appen kan du ha flera tsconfig.json-filer). Annars använder TypeScript-tjänsten standardalternativ för TypeScript för filen.
Föredragen lösning
Din tsconfig.json bör vara:
{
"version": "1.5.0",
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"noImplicitAny": false,
"removeComments": true,
"noLib": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"listFiles": true,
"isolatedModules": false,
"moduleResolution": "node",
"suppressImplicitAnyIndexErrors": true
},
"include": [
"typings/thera/thera.d.ts",
"typings/browser.d.ts",
"typings/main.d.ts",
"typings/meteor.d.ts",
"typings/meteor_server.d.ts",
"your_app_directory/**/*"
],
"exclude": [ "node_modules" ],
"compileOnSave":false //not required but is suggested for meteor projects
}
En annan lösning
Du kan ange standardalternativ i TypeScript-inställningarna (spåra ändringar-alternativet bör vara avmarkerat om du inte vill ha automatisk kompilering):
Obs: Om du inte gillar det nya beteendet kan du inaktivera TypeScript-tjänsteintegrationen under "Arkiv | Inställningar | Språk & ramverk | TypeScript" -> "Använd TypeScript-tjänst".
Svar #2
Fungerar även i WebStorm 2020.1.2. Tack.

