TypeScript error

TS6133: A variable, import or parameter that is never read

  • Error TS6133
  • Reported with noUnusedLocals
  • Reported with noUnusedParameters
  • Tested with TypeScript 5.9

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

CodeTS6133
Message'{0}' is declared but its value is never read.
TypeScript's categoryerror
Listed underClasses, 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

report.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: report.js(2,1): error TS6133: 'readFile' is declared but its value is never read. report.js(9,35): error TS6133: 'currency' is declared but its value is never read. report.js(11,9): error TS6133: 'count' is declared but its value is never read. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. report.js(2,1): error TS6133: 'readFile' is declared but its value is never read. report.js(9,35): error TS6133: 'currency' is declared but its value is never read. report.js(11,9): error TS6133: 'count' is declared but its value is never read. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. report.js(2,10): error TS6133: 'readFile' is declared but its value is never read. report.js(9,35): error TS6133: 'currency' is declared but its value is never read. report.js(11,9): error TS6133: 'count' is declared but its value is never read. checked 21 October 2026
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);
}
An unused import, variable and parameter.
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 only index).
  • noUnusedLocals or noUnusedParameters is 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.

report.js TypeScript 5.9.3 TypeScript 5.9.3, run 21 October 2026: No errors. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. No errors. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. No errors. checked 21 October 2026
/**
 * @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);
}
Remove what is unused, or prefix a required parameter with _.
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, @import is 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 under noUnusedLocals.

Sources

Last reviewed 20 October 2026.