tsc TS6133: 'x' is declared but its value is never read (noUnusedLocals) in CI
TS6133 reports an unused local variable, import, or parameter. With noUnusedLocals / noUnusedParameters enabled, tsc raises it as an error, so a harmless leftover binding fails the build in CI.
What this error means
tsc fails with "error TS6133: 'x' is declared but its value is never read." for an import or variable that is never used, often code that lints clean locally without these flags.
src/util.ts:1:10 - error TS6133: 'readFile' is declared but its value is never read.
1 import { readFile } from 'node:fs/promises';
~~~~~~~~Common causes
An unused import or variable left after refactoring
A binding stayed behind when the code that used it was removed, and noUnusedLocals turns that into a hard error.
CI enables noUnusedLocals where the editor did not
The editor may not flag unused locals, so the leftover binding only fails when CI runs tsc with the stricter tsconfig.
How to fix it
Remove the unused binding
- Delete the unused import or variable named in the error.
- For a parameter you must keep, prefix it with
_so tsc ignores it. - Re-run tsc to confirm TS6133 clears.
// drop the unused import, or rename an unused param to _
function handler(_req: Request, res: Response) { res.end(); }Keep the flag and let it gate dead code
Rather than disabling the option, treat TS6133 as a useful signal that removes dead imports before they accumulate.
{
"compilerOptions": { "noUnusedLocals": true, "noUnusedParameters": true }
}How to prevent it
- Remove imports and locals as soon as they stop being used.
- Prefix intentionally-unused parameters with
_. - Run tsc with the CI tsconfig locally so these surface early.