TypeScript Compiler Options
--listFilesOnly — TypeScript CLI
Lists the compiler program file names and stops before ordinary semantic checking and emission. Includes transitive imports and library declarations, not just configured roots. An incompatible assignment in the tested project is not reported by this mode; normal checking detects TS2322. In contrast, --listFiles reports files during compilation and can still emit output. Do not treat successful listing as successful type checking. Baseline: TypeScript 5.8.3. Commands are run with the pinned local compiler in an isolated directory; omit file labels. CLI-only setting.
Formal Syntax & Structure
typescript syntaxtypescript
tsc -p . --listFilesOnlyParameters & Attributes
| Name | Type | Description |
|---|---|---|
| listFilesOnly | boolean | Optional command switch; omit to leave the command inactive. |
Working Example
Example Snippettypescript
// File: tsconfig.json (omit this label){ "compilerOptions": { "target": "ES2022", "module": "CommonJS", "strict": true, "types": [], "outDir": "dist" }, "files": [ "index.ts" ]}// File: index.ts (omit this label)import { count } from "./dep";export const value: number = count;// File: dep.ts (omit this label)export const count = "bad";// File: unused.ts (omit this label)export const unrelated = 1;
// Run in a temporary project:// tsc -p . --listFilesOnly --pretty false// tsc -p . --noEmit --pretty false