我有
对装饰器的实验性支持是一个在将来的版本中可能会发生变化的功能.设置'experimentalDecorators'选项`以删除此警告.
甚至我在tsconfig.json中的compilerOptions都有设置:
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
Run Code Online (Sandbox Code Playgroud)
有些奇怪的是,一些使用装饰器的随机类没有显示出警告,但在同一个项目中却没有.
什么可能导致TypeScript编译器的这种行为?
我已经通过 Vue-CLI v3.0.0-beta.15 创建了一个 Vue 项目,现在,一切正常,我的意思是,当我npm run serve编译并运行良好时,TypeScript 会抛出以下错误消息,并且仅在编辑器内部!
Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.
Run Code Online (Sandbox Code Playgroud)
我尝试过但没有奏效的事情:
我仔细检查experimentalDecorators我的tsconfig.json文件中 Vue 默认设置为 true 。
我尝试jsconfig.json使用以下选项创建一个文件:
{
"compilerOptions": {
"experimentalDecorators": true
}
}
Run Code Online (Sandbox Code Playgroud)我试图在 VSCode 中更改以下选项 "javascript.implicitProjectConfig.experimentalDecorators": true
现在,我正在使用带有 VSCode 的 Vetur 扩展,我已经在他们的 repo 上发布了一个问题,但我没有在 Visual Studio for Vue 中使用任何扩展,但我得到了同样的错误,所以我不知道是什么触发了它,但是我认为有些东西没有选择tsconfig.json文件。
以下是我为生成项目而采取的步骤: …