Skip to content

Conversation

andrewbranch
Copy link
Member

Fixes #62439
Less ambitious version of #62310

@Copilot Copilot AI review requested due to automatic review settings September 24, 2025 23:14
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Sep 24, 2025
@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 24, 2025
@andrewbranch
Copy link
Member Author

@typescript-bot test top400

@typescript-bot
Copy link
Collaborator

typescript-bot commented Sep 24, 2025

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top400 ✅ Started ✅ Results

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes handling of conditional exports when they map to null values by disabling fallback resolution behavior. The fix prevents TypeScript from continuing to search for modules when a package explicitly maps an export to null, which indicates the export is intentionally disabled.

Key changes:

  • Modified module resolution logic to respect null export mappings and stop fallback attempts
  • Updated tracing behavior to only log "Resolved under condition" when a non-null value is found
  • Added comprehensive test coverage for various module resolution strategies

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

File Description
tests/cases/conformance/moduleResolution/conditionalExportsResolutionFallbackNull.ts Test case demonstrating the fix with a package that maps "import" to null
tests/baselines/reference/*.trace.json Expected trace outputs showing module resolution stops at null mapping
tests/baselines/reference/*.errors.txt Expected error outputs confirming module not found
src/compiler/moduleNameResolver.ts Core fix to prevent fallback resolution on null mappings

@typescript-bot
Copy link
Collaborator

@andrewbranch Here are the results of running the top 400 repos with tsc comparing main and refs/pull/62483/merge:

Everything looks good!

@typescript-bot typescript-bot added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 25, 2025
@github-project-automation github-project-automation bot moved this from Not started to Needs merge in PR Backlog Sep 25, 2025
@andrewbranch andrewbranch merged commit 6f6efb4 into microsoft:main Sep 25, 2025
33 checks passed
@github-project-automation github-project-automation bot moved this from Needs merge to Done in PR Backlog Sep 25, 2025
@andrewbranch andrewbranch deleted the no-exports-condition-fallback-on-null branch September 25, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Backlog Bug PRs that fix a backlog bug
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Fail resolution when custom condition explicitly maps specifier '.' to null
3 participants