pub fn tsconfig_includes(tsconfig: &Path) -> Result<Vec<String>, Error>
Expand description

Invoke the TypeScript compiler with the listFilesOnly flag to enumerate the files included in the compilation process.

This function leans on the TypeScript compiler to determine this list of files used in the compilation process (instead of trying to calculate the list independently) because this list requires following import statements in JavaScript and TypeScript code. From the tsconfig exclude documentation:

Important: exclude only changes which files are included as a result of the include setting. A file specified by exclude can still become part of your codebase due to an import statement in your code, a types inclusion, a /// <reference directive, or being specified in the files list.

The TypeScript compiler is a project where the implementation is the spec, so this project trades the runtime penalty of invoking the TypeScript compiler for accuracy of output as defined by the “spec”.