Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebStorm 2016.3 error: Experimental support for decorators is a feature that is subject to change in a future release

Hi updated to latest WebStorm and I'm now getting this error:

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.

But in my tsConfig experimentalDecorators are set to true:

{
  "version": "1.5.0",
  "compilerOptions": {
    //...,
    "experimentalDecorators": true,   // <======== HERE
    //...,
  },
  "files": [
    //...
  ],
  "exclude": [ "node_modules" ]
}
like image 504
CommonSenseCode Avatar asked Nov 21 '16 20:11

CommonSenseCode


People also ask

What is experimental support for decorators?

Experimental Support For Decorators Is A Feature That Is Subject To Change In A Future Release. Set The 'Experimentaldecorators' Option In Your 'Tsconfig' Or 'Jsconfig' To Remove This Warning. Ts(1219) Angular With Code Examples.

How do you set the experimental decorators option?

Click on CTRL + , to open your editor's settings. In the search bar type: implicitProjectConfig. experimental. Check the checkbox of the Experimental Decorators setting.

How do I remove Experimentaldecorator warning in VSCode?

Solving warning: “Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning”


3 Answers

WS2016.3 applies config settings to a file only if the file is included in 'files' or 'include' tsconfig.json section. [More info about tsconfig.json]

So the config must include all project files (or if you have several parts of the app you can have several tsconfig.json files). Otherwise typescript service uses default typescript options for the file.

Preferred solution

Your tsconfig.json should be:

{
  "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
}

Another solution

You can specify default options in the TypeScript settings (track changes option should be unchecked if you don't want auto compilation):

TypeScript Settings

Note: If you don't like the new behaviour you can disable the typescript service integration in "File | Settings | Languages & Frameworks | TypeScript" -> "Use TypeScript service".

like image 67
anstarovoyt Avatar answered Oct 15 '22 22:10

anstarovoyt


Works in WebStorm 2020.1.2 as well. Thanks.

enter image description here

like image 23
yuva Avatar answered Oct 16 '22 00:10

yuva


  1. Open File -> Settings -> Languages & Frameworks -> Typescript
  2. In Options input add --experimentalDecorators --moduleResolution mode

enter image description here

Click the apply button at the bottom right

like image 6
Nan fish Avatar answered Oct 16 '22 00:10

Nan fish