Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore TS6133: "(import) is declared but never used"?

Tags:

typescript

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?

like image 478
jdm Avatar asked Jun 15 '17 10:06

jdm


People also ask

What is TS6133?

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.

Is declared but its value is never read?

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.

How do I disable TypeScript error?

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!


1 Answers

You probably have the noUnusedLocals compiler option turned on in your tsconfig.json. Just turn it off during development.

like image 200
Saravana Avatar answered Sep 19 '22 02:09

Saravana