Port #62483: Disable conditional exports fallbacks on null values#2732
Merged
jakebailey merged 2 commits intomainfrom Feb 11, 2026
Merged
Port #62483: Disable conditional exports fallbacks on null values#2732jakebailey merged 2 commits intomainfrom
jakebailey merged 2 commits intomainfrom
Conversation
…ull values When a package.json conditional export maps to null, stop searching instead of falling through to other conditions. Also only emit "Resolved under condition" trace when the result actually resolved. Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Disable conditional exports fallbacks on null values
Port #62483: Disable conditional exports fallbacks on null values
Feb 10, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Ports TypeScript #62483 to align package.json conditional exports resolution with Node.js semantics: when an exports/imports target is null, resolution should terminate for that entry (no fallback to later conditions like types).
Changes:
- Treat
JSONValueTypeNulltargets as terminal-unresolved (unresolved()) instead of “keep searching” (continueSearching()). - Only emit the “Resolved under condition …” trace when the result is actually resolved.
- Update conformance baselines to reflect that
nullblocks fallback and the module is not resolved.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/module/resolver.go | Stops conditional exports resolution when a matched condition maps to null; prevents misleading “resolved” tracing for unresolved results. |
| testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallbackNull(moduleresolution=nodenext).trace.json | Updates trace to show resolution terminates on null and the module is not resolved. |
| testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallbackNull(moduleresolution=nodenext).errors.txt | Updates expected diagnostics to include the unresolved module error (TS2307). |
| testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallbackNull(moduleresolution=nodenext).errors.txt.diff | Removes outdated diff baseline content (no longer applicable). |
| testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallbackNull(moduleresolution=node16).trace.json | Same baseline update for node16 resolution mode. |
| testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallbackNull(moduleresolution=node16).errors.txt | Same expected diagnostic update for node16 resolution mode. |
| testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallbackNull(moduleresolution=node16).errors.txt.diff | Removes outdated diff baseline content (no longer applicable). |
| testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallbackNull(moduleresolution=bundler).trace.json | Same baseline update for bundler resolution mode. |
| testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallbackNull(moduleresolution=bundler).errors.txt | Adds expected TS2307 diagnostic baseline for bundler mode output. |
| testdata/baselines/reference/submodule/conformance/conditionalExportsResolutionFallbackNull(moduleresolution=bundler).errors.txt.diff | Removes outdated diff baseline content (no longer applicable). |
sandersn
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports microsoft/TypeScript#62483.
When a package.json conditional export maps a specifier to
null, the resolver was treating it as "not found, keep searching," allowing fallback to subsequent conditions liketypes. Per Node.js semantics,nullshould terminate resolution for that entry.{ "exports": { ".": { "import": null, "types": "./dist/index.d.ts" } } }Previously,
import: nullwould fall through totypes, incorrectly resolving the module. Now it correctly stops resolution.JSONValueTypeNullcase inloadModuleFromTargetExportOrImportfromcontinueSearching()tounresolved()— stops the search instead of falling throughresult.isResolved()guard on the "Resolved under condition" trace — a null match shouldn't be traced as a resolution✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.