首页 > 技术文章 > 对修饰器的实验支持功能在将来的版本中可能更改。在 "tsconfig" 或 "jsconfig" 中设置 "experimentalDecorators" 选项以删除此警告。ts(1219)

Annely 2021-04-03 13:03 原文

  • 方法一:设置VSCode选项

    管理==>设置==>搜索experimentalDecorators==>打上勾勾

  • 方法二:增加jsconfig文件

    在根目录下新建jsconfig.json文件

    • 在根目录下新建jsconfig.json文件

      {
        "experimentalDecorators": true, // 主要是这个
        "exclude": [
          "node_modules",
          "dist"
        ],
      }
    • jsconfig详情

    • 方法三:增加tsconfig文件

      在根目录下新建tsconfig.json文件

      {
        "compilerOptions": {
          "experimentalDecorators": true, // 主要是这个
        },
        "exclude": ["node_modules"],
        "include": ["src"]
      }
    • 注意:使用装饰器的js文件后缀需要修改成.ts

推荐阅读