microsoft/TypeScript

Provide --build/--incremental APIs for build tools

DanielRosenwasser opened this issue ยท 7 comments

When we added support for composite projects and implemented --build mode (#3469, #25600), we only provided a few APIs, but not enough that 3rd party tools could defer to TypeScript's understanding of composite projects to instruct these tools how to build intelligently.

We'd like to provide some stable API so tools like gulp and Webpack can easily operate over composite projects with project references.

This would be great. The TensorFlow.js team is using karma-typescript for testing in the browser, and we can't migrate to composite build yet since the compiler API doesn't work for composite.

const tsconfig = ; // parsed ts config
// tsconfig.fileNames includes only the files mentioned in "include".
ts.createProgram(tsconfig.fileNames, tsconfig.options, compilerHost);
// Failed since `fileNames` doesn't contain files from "referenced projects"

This issue now also tracks --incremental work since they are both related in some capacity.

Closed by #31432

Thanks for the new APIs, @sheetalkamat.

Is there a separate issue open for updating the docs? I know, personally, I've found the docs around the compiler APIs (as opposed to the language itself) to be rather lacking and often out-of-date.

Not that I am aware of. @DanielRosenwasser do you want me to keep this open or create new issue for documentation.

Hmm. This issue has been labeled with 3.5, ... and also has just been moved in the roadmap from 3.6 to 3.5 ... but I cannot find e.g. createIncrementalProgram() in the declarations of typescript@3.5.3.

So what's going on? /cc @DanielRosenwasser