APIs to Support —build and —incremental
TypeScript 3.0 introduced support for referencing other and building them incrementally using the —build
flag.Additionally, TypeScript 3.4 introduced the —incremental
flag for saving information about previous compilations to only rebuild certain files.These flags were incredibly useful for structuring projects more flexibly and speeding builds up.Unfortunately, using these flags didn’t work with 3rd party build tools like Gulp and Webpack.TypeScript 3.6 now exposes two sets of APIs to operate on project references and incremental program building.
For creating —incremental
builds, users can leverage the createIncrementalProgram
and createIncrementalCompilerHost
APIs.Users can also re-hydrate old program instances from .tsbuildinfo
files generated by this API using the newly exposed readBuilderProgram
function, which is only meant to be used as for creating new programs (i.e. you can’t modify the returned instance - it’s only meant to be used for the oldProgram
parameter in other create*Program
functions).
For leveraging project references, a new createSolutionBuilder
function has been exposed, which returns an instance of the new type SolutionBuilder
.
For more details on these APIs, you can see the original pull request.