Compiler Checks For Unused Params And Variables
There are a number of linter-esque checks that you can tell the TypeScript compiler to make when it is checking your code. There are two that prevent values from going unused: one for parameters and the other for variables.
The noUnusedLocals
config, which defaults to false
, can be set to true
. This will cause the compiler to fail if a locally declared variable goes unused.
The noUnusedParameters
config, which also defaults to false
, can be set to true
. This will cause the compiler to fail if a function param goes unused.
Fixing the previous error could then result in this one.
Here is what the tsconfig.json
would look like:
Last updated