noUnusedParameters
An argument nobody uses
Reports parameters that are declared and never read, with a leading underscore as the documented way to say you meant it.
- Since
- TypeScript 2.0
- strict
- Not in strict
- In your tsconfig
"noUnusedParameters": true
The same snippet both times. Only the option changed.
With it off
"noUnusedParameters": falseexport function greet(name: string, title: string) { return name }
Compiles clean
With it on
"noUnusedParameters": trueexport function greet(name: string, title: string) { return name }
Emits TS6133
Why the compiler bothers
Unlike an unused local, an unused parameter is often correct — a callback whose signature is fixed by whoever calls it does not get to drop the arguments it ignores. That is why the underscore convention is part of the rule rather than a workaround: `_event` is not silenced by a comment or a disable directive, it is silenced by saying what you mean in the name, which survives a rename and reads correctly to the next person.
Takeaway
Prefix with `_` rather than reaching for a disable comment.
Where to go next
22 options

