Incremental file watching for composite projects in —build —watch

TypeScript 3.0 introduced a new feature for structuring builds called “composite projects”.Part of the goal here was to ensure users could break up large projects into smaller parts that build quickly and preserve project structure, without compromising the existing TypeScript experience.Thanks to composite projects, TypeScript can use —build mode to recompile only the set of projects and dependencies.You can think of this as optimizing inter-project builds.

TypeScript 2.7 also introduced —watch mode builds via a new incremental “builder” API.In a similar vein, the entire idea is that this mode only re-checks and re-emits changed files or files whose dependencies might impact type-checking.You can think of this as optimizing intra-project builds.

Prior to 3.3, building composite projects using —build —watch actually didn’t use this incremental file watching infrastructure.An update in one project under —build —watch mode would force a full build of that project, rather than determining which files within that project were affected.

In TypeScript 3.3, —build mode’s —watch flag does leverage incremental file watching as well.That can mean signficantly faster builds under —build —watch.In our testing, this functionality has resulted in a reduction of 50% to 75% in build times of the original —build —watch times.You can read more on the original pull request for the change to see specific numbers, but we believe most composite project users will see significant wins here.