In VSCode, I get the error:
"Experimental support for decorators is a feature that is subject to change in a future release. Specify '
--experimentalDecorators
' to remove this warning."
I can add the --experimentalDecorators
flag to my tasks.json
file to remove this error on build, but I can't seem to remove it from my intellisense or error list when I load VSCode.
Is there a way to do this?
Go to File -> Preferences -> Settings. 2. Search "experimentalDecorators" 3. Check Enable/disable experimentalDecorators 4.
enable": false //... } in our settings. json file to disable TypeScript and JavaScript warnings by setting typescript. validate.
I was having this same error. I added the following tsconfig.json
file to my project root, restarted VSCode and it finally went away:
{ "compilerOptions": { "emitDecoratorMetadata": true, "experimentalDecorators": true, "module": "amd", "target": "ES6" } }
UPDATE:
I've noticed that sometimes VS Code will not suppress this warning until you add a "files" array in your tsconfig.json, even an empty one will work. For me this has worked every single time now, if the message does not disappear, try the following:
{ "compilerOptions": { ... }, "files": [], "exclude": [ "node_modules" ] }
Perhaps this will explain why everyone has mixed results?
VSC is by default looking at its own TS library and definition. If you're using a different version (which is very likely) you should point VSC to look for that versions definition.
In my settings.json
file, i have the following set up:
// Place your settings in this file to overwrite default and user settings. { "typescript.tsdk": "node_modules\\typescript\\lib" }
I believe you can set this for either your User Settings or your Workspace Settings. So you can do a one time configuration in your User Settings or just for one project/workspace. This works if you have your typescript installed locally in the specified folder - which i believe is the default nodes module folder.
To edit your settings go to File/Preferences/User Setting
or File/Preference/Workspace Settings
.
UPDATE: Visual Studio Code just released a new version with better support for different versions of typescript. Check it out here: https://code.visualstudio.com/updates#_languages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With