Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Experimental decorators warning in TypeScript compilation

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?

like image 293
bensiu Avatar asked Jul 08 '16 16:07

bensiu


People also ask

Are decorators experimental in TypeScript?

Decorators provide a way to add both annotations and a meta-programming syntax for class declarations and members. Decorators are a stage 2 proposal for JavaScript and are available as an experimental feature of TypeScript. NOTE Decorators are an experimental feature that may change in future releases.

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 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”

How do I add an Experimentaldecorator in Jsconfig?

The solution above: "In Visual Code Studio Go to File >> Preferences >> Settings, Search "decorator" in search field and Checking the option JavaScript › Implicit Project Config: Experimental Decorators" solved the problem.


1 Answers

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.

like image 106
linguamachina Avatar answered Sep 22 '22 02:09

linguamachina