- Error
- Reported by the type checker
TS6196
'{0}' is declared but never used.
A type, interface, class or type parameter is declared but never used. Remove it or use it.
What it means
With noUnusedLocals on, declarations that are only types (type aliases, interfaces) and local classes that are never referenced are reported with this code; TS6133 covers values that are never read. Unused type parameters are reported under noUnusedParameters.
Example
{
"compilerOptions": {
"strict": true,
"target": "es2022",
"module": "esnext",
"moduleResolution": "bundler",
"noEmit": true,
"noUnusedLocals": true
}
}
interface Draft {
title: string;
}
export const x = 1;
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(1,11): error TS6196: 'Draft' is declared but never used.
Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01.
How to fix
- Delete the unused declaration.
- If it's meant for other modules, export it.