While working on a TypeScript project, I commented out a line, and got the error:
Failed to compile
./src/App.tsx (4,8): error TS6133: 'axios' is declared but never used.
This error occurred during the build time and cannot be dismissed.
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?
error TS6133: 'input' is declared but its value is never read. This happens because we declared the input parameter in the function without using it. You can get rid of this error by using the declared parameter in the function body or by setting the option in the tsconfig. json file to false.
To solve 'is declared but its value is never read' error in TypeScript, prefix any unused parameter name with an underscore, or disable the noUnusedLocals and noUnusedParameters options in your tsconfig. json file to silence the error in your entire project.
Use // @ts-ignore to ignore the type checking errors on the next line in a TypeScript file. If you use a linter, you might have to add a comment to also suppress linting errors when using ts-ignore - // eslint-disable-next-line @typescript-eslint/ban-ts-comment . Copied!
You probably have the noUnusedLocals
compiler option turned on in your tsconfig.json
. Just turn it off during development.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With