Debugging Typescript tsc Builds
Tips on how to debug tsc builds.
Setting up or modifying Typescript builds can be finicky. Here’s a collection of Typescript compiler (tsc
) commands that are useful for debugging.
–showConfig
Print the compiler configuration and exit.
Useful for:
- Debugging nested or extended
tsconfig
s, or check if CLI arguments are overridingtsconfig
settings.
–listFiles
Lists the files that are processed as part of the build.
NOTE:
--listFilesOnly
will list files and exit, if that’s all that’s needed.
Useful for:
- Figuring out if your
tsconfig
include
andexclude
settings are working as expected.
–listEmittedFiles
List the paths of all files generated from the build.
Useful for:
- Check output file locations.
- Check that expected files are being generated.
–traceResolution
See what paths are considered when finding modules (module resolution) and which module ends up being picked.
Useful for:
- Determining which paths are checked during module resolution when unable to find modules.
- See if the correct module is picked up with nested packages, custom package locations, etc.
–diagnostics
Breakdown of size project (files, lines of code, number of types, …) and compiler performance per compilation stage.
NOTE: This is a subset and user friendly version of
--extendedDiagnostics
.
Useful for:
- Debug compiler performance.
- See how big and cool your project is.
-
No direct link available, sorry! ↩