Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Fixing Module Resolution Cache Behavior in noDts Projects #61029

Open
Shinkhal opened this issue Jan 23, 2025 · 0 comments
Open

[Bug] Fixing Module Resolution Cache Behavior in noDts Projects #61029

Shinkhal opened this issue Jan 23, 2025 · 0 comments

Comments

@Shinkhal
Copy link

🔎 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:

  1. Updates to root files only when required.
  2. Adding isBackgroundProject for background project updates.
  3. 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant