vue3+ts-tsconfig.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
自我記錄
翻譯
選項 ‘importsNotUsedAsValues’ 已被棄用,并將在 TypeScript 5.5 中停止使用。請指定編譯器選項 ‘“ignoreDeprecations”: “5.0”’ 來消除此錯誤。請改用 ‘verbatimModuleSyntax’。
臨時解決方案 "ignoreDeprecations": "5.0"
{"extends": "@vue/tsconfig/tsconfig.json","compilerOptions": {"ignoreDeprecations": "5.0",// 添加這句代碼"sourceMap": true,"baseUrl": ".","paths": {"@/*": ["./src/*"]},"lib": ["esnext", "dom"],"types": ["@dcloudio/types"]},"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}
或者更新TS版本,個人認為不更新為最新的好一些!
更新 TypeScript 版本: 首先,確保您的 TypeScript 版本升級到 5.5 或更高版本。這將幫助您避免因為使用了被棄用的選項而產生問題。