Print names of files which TypeScript sees as a part of your project and the reason they are part of the compilation.
For example, with this project of just a single index.ts
file
sh
example
├── index.ts
├── package.json
└── tsconfig.json
example
├── index.ts
├── package.json
└── tsconfig.json
Using a tsconfig.json
which has explainFiles
set to true:
json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"explainFiles": true
}
}
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"explainFiles": true
}
}
Running TypeScript against this folder would have output like this:
❯ tsc
node_modules/typescript/lib/lib.d.ts
Default library for target 'es5'
node_modules/typescript/lib/lib.es5.d.ts
Library referenced via 'es5' from file 'node_modules/typescript/lib/lib.d.ts'
node_modules/typescript/lib/lib.dom.d.ts
Library referenced via 'dom' from file 'node_modules/typescript/lib/lib.d.ts'
node_modules/typescript/lib/lib.webworker.importscripts.d.ts
Library referenced via 'webworker.importscripts' from file 'node_modules/typescript/lib/lib.d.ts'
node_modules/typescript/lib/lib.scripthost.d.ts
Library referenced via 'scripthost' from file 'node_modules/typescript/lib/lib.d.ts'
index.ts
Matched by include pattern '**/*' in 'tsconfig.json'
❯ tsc
node_modules/typescript/lib/lib.d.ts
Default library for target 'es5'
node_modules/typescript/lib/lib.es5.d.ts
Library referenced via 'es5' from file 'node_modules/typescript/lib/lib.d.ts'
node_modules/typescript/lib/lib.dom.d.ts
Library referenced via 'dom' from file 'node_modules/typescript/lib/lib.d.ts'
node_modules/typescript/lib/lib.webworker.importscripts.d.ts
Library referenced via 'webworker.importscripts' from file 'node_modules/typescript/lib/lib.d.ts'
node_modules/typescript/lib/lib.scripthost.d.ts
Library referenced via 'scripthost' from file 'node_modules/typescript/lib/lib.d.ts'
index.ts
Matched by include pattern '**/*' in 'tsconfig.json'
The output above show:
- The initial lib.d.ts lookup based on
target
, and the chain of.d.ts
files which are referenced - The
index.ts
file located via the default pattern ofinclude
This option is intended for debugging how a file has become a part of your compile.