Skip to content

Use TypeScript project references

Warren Gifford requested to merge ts-composite-projects into master

Created by: felixfbecker

We have many TS projects that partly reference each other. Currently, TS has to double-compile the common files for every project. This is noticeable when:

  • Running yarn all:typecheck
  • In CPU/RAM usage in VS Code, as we had 6 tsc compilers running concurrently
  • In sluggish code intelligence in VS Code, as the compiler has to deal with a mega-project instead of relying on precompiled project outputs
  • Node projects like lsif or extrunner cannot easily share code with shared

After this PR, we only run one tsc in VS Code and yarn all:typecheck. For each project, compilation results are written to disk (out directories). If nothing changed in a project, it does not get rebuilt. Code intelligence still jumps directly to the source as of TS 3.7. Node projects like lsif or extrunner can easily share functions from shared with this by referencing the project (it's not referenced yet as there are no references yet). It also enforces that we don't use circular references between projects.

This also changes our webpack configs and gulpfiles to be written in JS with @ts-check instead of TS. This saves multiple seconds of gulp tasks (which is run on every build and on yarn install) and makes it easier to use project references as those files don't have to be in a project. @ts-check provides a sufficient level of in-editor checking and editor experience, and these files are rarely changed, with mistakes usually resulting in build misconfiguration that wouldn't be caught by TS anyway.

Merge request reports

Loading