TypeScript Reference ยท tsconfig: Projects, Files and Watch Options
TypeScript listFiles and listEmittedFiles options
Reference for the TypeScript listFiles and listEmittedFiles options: print every file in the program and every file written, with output format and tips.
Two small options show you exactly what the compiler touched. listFiles prints the full path of every file that is part of the program after resolving imports, including declaration files from libraries and @types. listEmittedFiles prints the path of each output file the compiler wrote.
They are quick answers to "why is this file in my build?" (see also explainFiles) and "where did my output go?".
tsc --listFiles --noEmit tsc --listEmittedFiles
Try it
The real output contains absolute paths from your machine, so these examples work on a sample list.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or readFileSync(0)), it gets the next line from this box.
Syntax
{ "compilerOptions": { "listFiles": true, "listEmittedFiles": true } }
| Option | Output |
|---|---|
listFiles |
One absolute path per line for every file in the program. |
listEmittedFiles |
A line beginning with TSFILE: for each file written (JavaScript, maps, declarations). |
Both are booleans and default to false. They affect console output only, not what is compiled.
Usage notes
- Use with
--noEmitwhen you only care about inputs;listEmittedFilesneeds emit enabled. - Surprising entries. A thousand
lib.dom.*.d.tsor@typesfiles often meanlibortypesis broader than you intended. Settingtypesto a short list trims the program. - Feed it to scripts. Because each file is on its own line, output can be filtered with ordinary shell tools; the
TSFILE:prefix lets you tell emitted paths apart from other messages. - Slow builds. Compare the file count against
extendedDiagnosticsto see whether the program is larger than expected. - Watch mode repeats the listing on each rebuild, which can be noisy.
- Another view.
tsc --showConfigprints the final merged configuration, so you can see the effectiveincludeandexcludetoo.