Add assumeChangesOnlyAffectDirectDependencies as a option to skip checking and generating .d.ts files for files indirectly importing affected file by sheetalkamat · Pull Request #35711 · microsoft/TypeScript (original) (raw)

If your files are all global, TypeScript assumes that they are all compose into one big ball of globals that can impact each other in arbitrary ways. Regardless of any sort of arrangement based on file order or /// <reference path="..." /> directives, globals cause non-local errors and changes in types on every file in your project, so there's no assumptions we can make based on efficiency and independent checking.

For example, imagine 3 files

Now imagine another global file comes along

That declaration of x conflicts with other declaration of x. To model that, every single global file is effectively a direct dependency of every other global file.

image

Or, as a more 3D diagram might illustrate

image

My recommendation is to move off of global code (which our team is in the process of at #35561)