• Error
  • Reported by the type checker

TS6133

'{0}' is declared but its value is never read.

A local variable, import, parameter or private member is declared but never read. Remove it, or prefix an unused parameter with `_`.

What it means

Reported when noUnusedLocals (for variables, imports, functions and private members) or noUnusedParameters (for parameters) is on. Something is declared but its value is never read. Assigning to it doesn't count as reading it. Editors show these declarations faded.

Example

tsconfig.json
{
  "compilerOptions": {
    "strict": true,
    "target": "es2022",
    "module": "esnext",
    "moduleResolution": "bundler",
    "noEmit": true,
    "noUnusedLocals": true
  }
}
index.ts
export function total(prices: number[]): number {
  const tax = 0.1;
  return prices.reduce((a, b) => a + b, 0);
}
ts-r-check -p tsconfig.json --pretty false ts-r output
index.ts(2,9): error TS6133: 'tax' is declared but its value is never read.

Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01.

How to fix

  • Delete the unused declaration or import.
  • For a parameter you must keep (for example a callback signature), name it with a leading underscore: _event.
  • For destructuring where you only want the rest, const { id: _id, ...rest } = obj keeps it quiet.