Vscode: experimentalDecorators Typescript warning always present

Created on 23 Jun 2016  路  23Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.3.0-insider
  • OS Version: El Capitan

Steps to Reproduce:

  1. Create a Typescript project
  2. Use decorators (I am using Mobx)

I keep seeing the warning:

[ts] Experimental suport for decorators is a feature that is subject to chang in a future release. Set the 'experimentalDecoratos' option to remove this warning.

Where should I set this option? Because my tsconfig.json should be right

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "declaration": false,
    "noImplicitAny": false,
    "removeComments": false,
    "isolatedModules": false,
    "jsx": "react",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "noLib": false,
    "preserveConstEnums": true,
    "suppressImplicitAnyIndexErrors": true,
    "outDir": "./dist/"
  },
  "exclude": [
    "client",
    "node_modules",
    "typings/browser",
    "typings/browser.d.ts"
  ]
}
typescript upstream

Most helpful comment

I had a similar issue and this fixed it for me:

How to remove experimentalDecorators warning in VSCode

All 23 comments

This issue was moved to Microsoft/TypeScript#9335

Try to remove the path property in the tsconfig

I tried everything (e.g. removed the path property) but nothing helped. The only config that worked is the previous one: https://raw.githubusercontent.com/AngularClass/angular2-webpack-starter/888795d1c20c157d023ee2b9dcc503be11913019/tsconfig.json

@Martin-Wegner please make sure your comments are raised here https://github.com/Microsoft/TypeScript/issues/9335 as well since VS Code itself can't fix this.

I had a similar issue and this fixed it for me:

How to remove experimentalDecorators warning in VSCode

@Ihatetomatoes my vscode fixed

Removing the files property within tsconfig.json fixed it for me.

@Ihatetomatoes solution works for me.

@Ihatetomatoes Thank you.
It's work.

@Ihatetomatoes works for me, but I had to restart it
thanks!

@Ihatetomatoes Worked for me as well. Is there a way to add this to VS Code's settings rather than needing to generate a tsconfig.json file per project?

@ConAntonakos, I don't think it can be included in the .vscode settings.

+1

@dbaeumer This issue also applies to pure JS projects, I think it should be reopened. Adding a tsconfig.json just to get rid of the error cannot be the proper solution.

@mjbvz can you please follow up.

If you have a tsconfig.json or jsconfig.json and are still seeing a warning about experimentalDecorators not being supported, most likely you working with files outside of the project. That explains why removing the files config option fixes the problem.

To check if this is indeed the case, open the file with the warning and run the Go to Project Configuration command. This will jump to the jsconfig or tsconfig that the file belongs to, or alert you if the file is not part of any project

We are also tracking a feature request that would allow enabling experimentalDecorators using a vscode setting: #14985

Was having the issue in a JS project.
The following VS Code workspace settings.js resolved it - would work for both [ts] and [js] projects

{
    "typescript.validate.enable": false,
    "javascript.validate.enable": false
}

@mjbvz Just adding: Remember to do Reload Window command. Worked for me, thanks!

@harmon25's solution worked.

I'm validating my code with eslint anyway so I guess disabling this should be fine.

In my case the Build Action for the tsconfig.json was "None", once I've changed it to "Content" it worked.

image

Adding this comment in case it helps anyone. I was having this same problem, and the steps above didn't help. My problem is I had assumed tsconfig.json should go in .vscode, but it should actually go in the project root folder. Once I moved it there it the decorator warning went away without even restarting the IDE.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisdias picture chrisdias  路  3Comments

biij5698 picture biij5698  路  3Comments

DovydasNavickas picture DovydasNavickas  路  3Comments

NikosEfthias picture NikosEfthias  路  3Comments

borekb picture borekb  路  3Comments