I've created a Vue project through Vue-CLI v3.0.0-beta.15, now, everything is working, I mean, when I do npm run serve
it compiles and runs fine but TypeScript throws the following error message and only inside the editor!
Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
The things I've tried and didn't work:
I double check that the experimentalDecorators
is set to true in my tsconfig.json
file which Vue does by default.
I tried to create a jsconfig.json
file with the following options:
{
"compilerOptions": {
"experimentalDecorators": true
}
}
I tried to change the following options in VSCode "javascript.implicitProjectConfig.experimentalDecorators": true
Now, I'm using the Vetur extension with VSCode which I already posted an issue on their repo but I don't use any extensions with Visual Studio for Vue and yet I get the same error so I don't know what triggers it but I think that something doesn't pick the tsconfig.json
file.
Here are the steps I've taken to generate the project:
@vue/cli
I've used the following options:
Then navigate to dashboard/src/views/Home.vue
That's how it looks like in Visual Studio:
And that's how it looks like in VSCode:
Vue is written in TypeScript itself and provides first-class TypeScript support. All official Vue packages come with bundled type declarations that should work out-of-the-box.
The experimentalDecorators setting enables experimental support for decorators. If you use the include or files options, make sure the file you are using decorators in is included in your project and is being tracked by TypeScript.
In VSCode, Go to File => Preferences => Settings (or Control+comma) and it will open the User Settings file. Search "javascript. implicitProjectConfig. experimentalDecorators": true and then check the checkbox for experimentalDecorators to the file and it should fix it.
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”
Have you seen this post ?
Maybe you should try : Go to File => Preferences => Settings (or Control+comma) and it will open the User Settings file. Add "javascript.implicitProjectConfig.experimentalDecorators": true
EDIT :
Ok so in your first exemple you have opened your project in the experiment
directory, but the tsconfig.json is located in a sub directory, the tsconfig must be in the root directory. try to open vscode with dashboard
as the root folder of your vscode project and restart your editor.
As it turns out I had to create jsconfig.json
at the root of the folder where the tsconfig.json
file is and the error in Visual Studio goes away but VSCode still displays the error regardless to the options I've set but this seems like it's a Vetur bug as opposed to a bug in VSCode, TypeScript or a configuration issue.
Opening the Dashboard
folder as opposed to the Src
folder which is the actual root of my project "fixed" the problem in VSCode so I guess that Vetur doesn't pick the tsconfig.json
file when it's nested.
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