Skip to content

Program is not completely re-used when imports change but import graph is identical Β #56846

@devversion

Description

@devversion

πŸ”Ž 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

Metadata

Metadata

Assignees

Labels

Working as IntendedThe behavior described is the intended behavior; this is not a bug

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions