TypeScript: error TS6133: 'x' is declared but its value is never read.
noUnusedLocals/noUnusedParameters flag an unused variable, import or parameter.
error TS6133: 'x' is declared but its value is never read.'x' is declared but its value is never read. ts(6133)TS6133 declared but its value is never readerror TS6196: 'Foo' is declared but never used.error TS6192: All imports in import declaration are unused. Meaning
Remove it, use it, or prefix parameters with _ (_req). For imports, delete the unused import (organise imports). To relax, disable the option in tsconfig — many teams leave it to ESLint instead. Build errors in CI often come from this strict flag.
Common causes
- Unused import/variable
- Unused function parameter (Express
req) - Leftover debug code
- Destructured value unused
noUnusedLocalsenabled
⚡ Quick fix
- Remove or use the identifier
- Prefix unused parameters with
_ - Disable
noUnusedLocals/Parametersor handle via ESLint
Detailed fix by platform
TypeScript
app.get("/", (_req, res) => res.send("ok"));
How to diagnose
- Identifier — Needed?
- Parameter — _prefix?
- Option — Enabled?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Cannot find module './App.vue' or its corresponding type declarations TypeScript: error TS2307: Cannot find module './App.vue' or its corresponding type declarations.
- Failed to compile: ESLint errors during next build Next.js: Failed to compile. ./src/app/page.tsx 12:7 Error: 'x' is assigned a value but never used. @typescript-eslint/no-unused-vars
- TS1005: ';' expected / ',' expected (syntax error) TypeScript: error TS1005: ';' expected.
Most viewed in TypeScript
- TS2322 TS2322: Type 'X' is not assignable to type 'Y'
- TS2366: Function lacks ending return statement TypeScript: error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
- TS1259: Module can only be default-imported using the 'esModuleInterop' flag TypeScript: error TS1259: Module '"express"' can only be default-imported using the 'esModuleInterop' flag
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026