-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Description
π Search Terms
program re-use, old program, oldProgram, imports changed, graph same, reuse result
π Version & Regression Information
n/a
β― Playground Link
No response
π» Code
No response
π Actual behavior
Consider an incremental program using oldProgram in the compiler API.
TypeScript will sometimes NOT fully re-use the program when a source file changed its imports even though the module graph remains the same. It considers structure changed. This is reasonable, but in some cases new imports may not signify that resolution results or the import graph has changed. A new import with existing imported modules may be added. e.g.
import {Directive} from `@angular/core`; // part of first compilation
import * as i0 from `@angular/core`; // added in the second! same module name!
π Expected behavior
TypeScript may consider deduplicating module names and would not treat the structure as invalidated. Later resolution validation as part of the re-use strategy may still bail out if discovers changes, but most of the time this is very likely the same (unless e.g. an import mode is used using with- this is NOT new behavior though)
Additional information about the issue
PR: #56845