How to remove experimentalDecorators warning in VSCode

Problem

Working on a Vue project with VSCode as code editor. Using typescript in the Vue component.

While VSCode keeps warning this message on the declaration of Component class name. Which is very annoying.

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

Tried to search a bit, in the VSCode github, they tell you to set experimentalDecorators to true in VSCode settings, and restart, however it’s not working.

Solution

you need to modify the typescript configuration. In tsconfig.json file (if you don’t have one, create it in your project’s root folder). Add this:

{
    "compilerOptions": {
        "experimentalDecorators": true,
        "allowJs": true
    }
}

Both experimentalDecorators and allowJs needs to be set to true

And then restart VSCode.

Done.




hank

No Comments


You can leave the first : )



Leave a Reply

Your email address will not be published. Required fields are marked *