Skip to content
Tutorials Center
My learning

Topics

TypeScript Reference ยท The tsc Command Line

tsc --showConfig

Reference for tsc --showConfig: print the fully resolved configuration after extends, defaults and command-line overrides, and use it to debug surprises.

tsc --showConfig prints the configuration tsc would use, as JSON, and then exits without compiling. The output has extends already merged, relative paths expanded, command-line overrides applied, and the final list of files included.

It answers the question "why is my project behaving like this?" faster than reading three nested config files. It is especially useful in monorepos where options come from a base config several folders up.

TEXT
tsc --showConfig
tsc -p tsconfig.build.json --showConfig
tsc --showConfig --strict false

Try it

The resolved config is what decides the errors you see. Here is code whose result depends on strict-family options; this site always runs with --strict.

TypeScript Behavior under strictNullChecks

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 Handling the undefined case

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

TEXT
tsc --showConfig [-p <path>] [options]

Typical output (abbreviated):

JSON
{
  "compilerOptions": {
    "strict": true,
    "target": "es2022",
    "module": "nodenext"
  },
  "files": [
    "./src/index.ts",
    "./src/util.ts"
  ]
}

Behavior:

  • Paths are shown relative to the config file.
  • Options set only by default are generally not listed; you see what was explicitly set, directly or through extends.
  • include and exclude are replaced by the expanded files list.
  • Command-line options appear in compilerOptions, so you can preview a flag.

Edge cases: if there is no tsconfig and no files are given, it reports that it cannot find one. Syntax errors in the config are reported instead of JSON.

Usage notes

  • Debug extends chains. If an option does not take effect, check whether a later config overrides it.
  • Check files for surprises. Missing files mean include patterns do not match; unexpected files mean exclude is too narrow.
  • Diff configs. Redirect the output to a file for two projects and compare them.
  • For the file list only, --listFilesOnly is closer to what the compiler really loads, including declaration files from node_modules.
  • Safe to run anywhere: it never writes build output.