tsconfig.app.json文件报红:Option ‘importsNotUsedAsValues‘ is deprecated...

创建vue3 + vite + ts项目时的 tsconfig.json(或者tsconfig.app.json) 配置文件经常会报一个这样的错误:
在这里插入图片描述
爆红:

Option ‘importsNotUsedAsValues’ is deprecated and will stop functioning in TypeScript 5.5.
Specify compilerOption ‘“ignoreDeprecations”: “5.0”’ to silence this error.
Use ‘verbatimModuleSyntax’ instead.ts

翻译后:
选项“importsNotUsedAsValues”已弃用,并将停止在TypeScript 5.5中运行。
指定compilerOption“”ignoreDeprecations“:”5.0“”以消除此错误。
使用’verbatimModuleSyntax’代替.ts

原因:

很明显,就是选项被启用了,可以根据提示去消除错误,下面就是解决方法:


{
   
  "extends": "@vue/tsconfig/tsconfig.web.json",
  "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
  "exclude": ["src/**/__tests__/*", "node_modules"],
  "compilerOptions": {
   
    "ignoreDeprecations": "5.0",  # 根据报错提示,加入这句话 #
    "composite": true,
    "paths": {
   
      "@/*": ["./src/*"],
      "vue-types": ["../../node_modules/vue-types"]
    }
  }
}


相关推荐

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-25 00:42:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-25 00:42:02       101 阅读
  3. 在Django里面运行非项目文件

    2023-12-25 00:42:02       82 阅读
  4. Python语言-面向对象

    2023-12-25 00:42:02       91 阅读

热门阅读

  1. 2023年State-of-AI-Report阅读

    2023-12-25 00:42:02       66 阅读
  2. 【算法】【动规】 最长等差数列

    2023-12-25 00:42:02       64 阅读
  3. 轮廓平滑方法

    2023-12-25 00:42:02       60 阅读
  4. 吉利银河L6 车机等问题交流/记录

    2023-12-25 00:42:02       120 阅读
  5. LinuxLMNP编译安装

    2023-12-25 00:42:02       48 阅读
  6. GO设计模式——17、解释器模式(行为型)

    2023-12-25 00:42:02       61 阅读
  7. overtureDNS使用介绍

    2023-12-25 00:42:02       63 阅读
  8. 【算法题】7. 整数反转

    2023-12-25 00:42:02       72 阅读
  9. Python-os.path 学习

    2023-12-25 00:42:02       52 阅读
  10. 正则表达式

    2023-12-25 00:42:02       51 阅读
  11. jQuery 实现带手柄自由调整页面大小的功能

    2023-12-25 00:42:02       69 阅读