问题描述
限时送ChatGPT账号..在处理 TypeScript 项目时,我注释掉了一行,并得到了错误:
While working on a TypeScript project, I commented out a line, and got the error:
编译失败
./src/App.tsx
(4,8): error TS6133: 'axios' is declared but never used.
此错误发生在构建期间,无法消除.
This error occurred during the build time and cannot be dismissed.
错误是对的,我在导入axios,但是我想暂时注释掉对axios.get
的调用.我很欣赏这个错误,因为它使我的导入保持干净,但在早期开发过程中是非常具有破坏性的.
The error is right, I am importing axios, but I wanted to temporarily comment out the call to axios.get
. I appreciate that error as it keeps my imports clean, but during early development is is pretty disruptive.
有什么方法可以禁用或忽略该警告?
Any way to disable or ignore that warning?
推荐答案
您可能在 tsconfig.json
中打开了 noUnusedLocals
编译器选项.只需在开发过程中将其关闭即可.
You probably have the noUnusedLocals
compiler option turned on in your tsconfig.json
. Just turn it off during development.
这篇关于忽略 TS6133:“(import) 已声明但从未使用过"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论