Closed as not planned
Description
🔎 Search Terms
- "module resolution cache issue"
- "noDts incremental behavior"
- "resolveSingleModuleNameWithoutWatching"
- "typescript incremental verification bug"
- "module resolution invalidation logic"
🕗 Version & Regression Information
- This behavior has been observed in all versions of TypeScript where
noDts
project resolutions are handled using the current module resolution cache logic. - The issue relates to changes in PR noDts project resolutions verification and updates for incremental behaviour #56016.
- I have not tested earlier versions due to project-specific behavior, but it appears the current resolution cache logic leads to incorrect incremental updates.
⏯ Playground Link
No response
💻 Code
// Example of module resolution
import { something } from "some-module";
// Adding a new file after project construction or repeating queries
// currently changes the project state when it shouldn't.
🙁 Actual behavior
- Module resolution cache was reused, causing failed lookup locations to be added unnecessarily.
- Repeated queries unexpectedly altered project state.
- Incremental updates failed to handle edge cases, such as sibling folder resolutions and files added after project construction.
🙂 Expected behavior
- Module resolution cache should remain read-only after program construction.
- Failed lookup locations should not be reused.
- Edge cases like sibling folder resolution and incremental verification for
resolveSingleModuleNameWithoutWatching
should work without impacting project state.
Additional information about the issue
This issue was fixed by marking the module resolution cache as read-only and updating the noDts
project behavior. Key improvements include:
- Updates to root files only when required.
- Adding
isBackgroundProject
for background project updates. - Addressing missing cases such as:
- Resolution of files not part of the project.
- Proper handling of files added after project construction.
- Incremental verification for
resolveSingleModuleNameWithoutWatching
.