Skip to content
Tutorials Center
My learning

Topics

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?".

TEXT
tsc --listFiles --noEmit
tsc --listEmittedFiles

Try it

The real output contains absolute paths from your machine, so these examples work on a sample list.

TypeScript Summarizing a file 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.

TypeScript Reading emitted file lines

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

JSON
{ "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 --noEmit when you only care about inputs; listEmittedFiles needs emit enabled.
  • Surprising entries. A thousand lib.dom.*.d.ts or @types files often mean lib or types is broader than you intended. Setting types to 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 extendedDiagnostics to see whether the program is larger than expected.
  • Watch mode repeats the listing on each rebuild, which can be noisy.
  • Another view. tsc --showConfig prints the final merged configuration, so you can see the effective include and exclude too.