简体   繁体   English

导出默认值后 vscode 是否支持装饰器? 如何让这个启用?

[英]Does vscode support decorator after export default? How to let this enabled?

Like on the picture below, when I write export default @Decorator class, vscode told me the syntax is wrong.如下图所示,当我编写 export default @Decorator 类时,vscode 告诉我语法错误。 How can I remove this error?我怎样才能消除这个错误?

vscode上的错误

Update:更新:

Yes, I know there are a lot of answer about how to enable decorator in vscode, but I really would like how to enable the decorator after the export default .是的,我知道有很多关于如何在 vscode 中启用装饰器的答案,但我真的很想知道如何在export default之后启用装饰器。

I just add the configuration in jsconfig.json我只是在 jsconfig.json 中添加配置jsconfig.json . . That's not work.那不行。

{
  "compilerOptions": {
    "experimentalDecorators": true
  }
}

Try adding below code in config-overrides.js, for other configuration please check https://code.visualstudio.com/docs/languages/jsconfig#_jsconfig-options尝试在 config-overrides.js 中添加以下代码,其他配置请查看https://code.visualstudio.com/docs/languages/jsconfig#_jsconfig-options

{
    "compilerOptions": {
        "experimentalDecorators": true
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM