Experimental decorators warning in TypeScript compilation

357,863

Solution 1

Although VS Code is a great editor for TypeScript projects, it needs a kick every now and again. Often, without warning, certain files cause it to freak out and complain. Mostly the fix seems to be to save and close all open files, then open tsconfig.json. After that you should be able to re-open the offending file without error. If it doesn't work, lather, rinse, and repeat.

If your tsconfig.json specifies its source files using the files array, IntelliSense will only function correctly if the file in question is referenced such that VS Code can find it by traversing the input file tree.

Edit: The 'reload window' command (added ages ago now) should solve this problem once and for all.

Solution 2

I've to add the following in the settings.json file of vscode to remove the warning.

"javascript.implicitProjectConfig.experimentalDecorators": true

VSCode -> Preferences -> Settings

enter image description here

UPDATE

As Clepsyd pointed out, this setting had been deprecated. You need to use now

"js/ts.implicitProjectConfig.experimentalDecorators":true

enter image description here

Solution 3

File -> Preferences -> Settings

Solution 4

This error also occurs when you choose "src" folder for your workspace folder.

When the root folder, folder where the "src", "node_modules" are located is chosen, the error disappears

Solution 5

Please follow the below step to remove this warning message. enter image description here

Step 1: Go to setting in your IDE then find or search the experimentalDecorators.enter image description here

Step 2: then click on checkbox and warning has been remove in your page.

enter image description here

Thank you Happy Coding ..........

Share:
357,863
bensiu
Author by

bensiu

PHP, Python and AngularJS developer

Updated on August 18, 2022

Comments

  • bensiu
    bensiu almost 2 years

    I receive the warning...

    Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option `to remove this warning.

    ... even though my compilerOptions in tsconfig.json have the following settings:

    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    

    What is weird is that some random classes that use decorators do not show that warning but the rest in the same project do.

    What could cause such behavior in the TypeScript compiler?