error TS6133: 'count' is declared but its value is never read. is reported, with noUnusedLocals on, for imports, variables, functions and private class members that nothing reads, and with noUnusedParameters on, for parameters. Neither option is part of strict.
With both options off the checker still notices: editors that run TypeScript's language service show the same names faded out, as a suggestion rather than an error, and tsc prints nothing.
At a glance
| Code | TS6133 |
|---|---|
| Message | '{0}' is declared but its value is never read. |
| TypeScript's category | error |
| Listed under | Classes, JSX and unused code |
| Turned on by | noUnusedLocals, noUnusedParameters |
| In .js files | Reported when the file is checked: checkJs in jsconfig.json, or // @ts-check at the top of the file |
The message is TypeScript's own text from its diagnostic messages file (Apache-2.0); {0} is filled in by tsc for each error.
What it looks like
import { readFile } from "node:fs/promises";error TS6133: 'readFile' is declared but its value is never read.
/**
* @param {number[]} totals
* @param {string} currency
*/
export function summarize(totals, currency) {error TS6133: 'currency' is declared but its value is never read.
const count = totals.length;error TS6133: 'count' is declared but its value is never read.
return totals.reduce((sum, t) => sum + t, 0);
}jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": ["node"],
"noUnusedLocals": true,
"noUnusedParameters": true
},
"include": ["*.js"]
} What causes it
- Code was removed and its import or variable was left behind.
- A parameter is required by a callback's position but not used (
(event, index) => ...using onlyindex). noUnusedLocalsornoUnusedParametersis on.
How to fix it
Remove it, or start a parameter's name with _
Delete unused imports and variables. A parameter you must keep for its position can start with an underscore (_currency), which noUnusedParameters skips by design.
/**
* @param {number[]} totals
* @param {string} _currency Kept for callers; not used yet.
*/
export function summarize(totals, _currency) {
return totals.reduce((sum, t) => sum + t, 0);
}jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": ["node"],
"noUnusedLocals": true,
"noUnusedParameters": true
},
"include": ["*.js"]
} Gotchas
- An import used only in a JSDoc type counts as read. For imports that exist only for types,
@importis cleaner: it is a comment, so it adds no import to the running code. - Destructuring to drop a property (
const { password, ...user } = row) is not reported: unused names next to a rest element are ignored, so this way of removing a property stays clean undernoUnusedLocals.
Sources
- TSConfig Reference: noUnusedLocals · TypeScript
- TSConfig Reference: noUnusedParameters · TypeScript
- diagnosticMessages.json (TypeScript 5.9.3) · TypeScript on GitHub
Last reviewed 20 October 2026.