vetur: `experimentalDecorators: true` in tsconfig.json is not working

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: macOS
  • Vetur version: 0.11.3
  • VS Code version: 1.18.1

Problem

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

I’ve add and enable experimentalDecorators option in tsconfig.json, and I tried decorator in pure .ts file, there was no warnings.

Reproducible Case

My source code:

<template lang="pug">
  #app
    router-view
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'

@Component
export default class App extends Vue {
  name = 'app'
}
</script>

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 14
  • Comments: 19 (5 by maintainers)

Most upvoted comments

Still not working in a vue file with tsconfig "experimentalDecorators": true, "allowJs": true, and vscode config "javascript.implicitProjectConfig.experimentalDecorators": true ,even with restart.

Hmmm… I restarted my Mac and it works just well now, so magically.

Actually, I’m still confused with the cause of this issue, but set “include” path in tsconfig.json is working for me.

Before:

"include": [
    // "src/**/*.ts"
  ]

image

Worked After:

{
  "compileOnSave": true,
  "compilerOptions": {
    "module": "esnext",
    "moduleResolution": "node",
    "target": "es5",
    "lib": ["dom", "es2015", "es2016"],
    "sourceMap": false,
    "declaration": true,
    "experimentalDecorators": true,
    "jsx": "react",
    "outDir": "lib",
    "noUnusedLocals": false 
  },
  "exclude": [
    "node_modules",
    "static",
    "lib"
  ],
  "include": [
    "src/**/*.ts"
  ]
}

I’m happy if somebody can point out my mistakes in the config file.

I’m not sure if this is an issue of the language server or the VSCode plugin, but it doesn’t work when you have a Workspace open. There is a workaround tho: Simply add a tsconfig.json to the workspace directory with the proper configuration. Then this will fix the issue in workspaces.

It was not resolved by any of the above solutions, but it was fixed by updating vscode to the latest version.

I just put “experimentalDecorators”: true in tsconfig.json

If you set, please restart VSCode. Still have problems, please open a new issue with template.

@HerringtonDarkholme It seems if I modify global .d.ts file, vetur will not recognize that unless exiting and restarting vsc.

So is it as expected and should be documented?