Skip to content

Normalize distributed type parameters in conditional type relationships - #64307

Open
Mateusz Burzyński (Andarist) wants to merge 1 commit into
microsoft:mainfrom
Andarist:distributed-conditional-type-relationships
Open

Mateusz Burzyński (Andarist) wants to merge 1 commit into
microsoft:mainfrom
Andarist:distributed-conditional-type-relationships

Conversation

@Andarist

Copy link
Copy Markdown
Contributor

fixes a regression from #64237 , cc Anders Hejlsberg (@ahejlsberg)

The target type here needs to be instantiated too - so the T can be mapped back to the non-distributed type parameter. The source type already does that mapping so the distributed type param on that side becomes non-distributed. But that creates an assymetry without mapping the target side too.

Copilot AI balanced review requested due to automatic review settings September 17, 2026 10:21
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 17, 2026
@typescript-automation typescript-automation Bot added For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 17, 2026
@typescript-automation

Copy link
Copy Markdown

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused normalization fix is consistent with the mapper behavior and has bidirectional regression coverage.

Pull request overview

Normalizes both sides of conditional true-branch relationships, restoring assignability for equivalent distributive conditional types.

Changes:

  • Instantiates the target true type with the inference mapper.
  • Adds a bidirectional regression test and generated baselines.
File summaries
File Description
tsc/internal/checker/relater.go Normalizes the target conditional branch.
tsc/testdata/tests/cases/conformance/types/conditional/conditionalTypes1.ts Adds regression coverage.
tsc/testdata/baselines/reference/conformance/conditionalTypes1.types Updates type baseline.
tsc/testdata/baselines/reference/conformance/conditionalTypes1.symbols Updates symbol baseline.
tsc/testdata/baselines/reference/conformance/conditionalTypes1.js Updates emit and declaration baseline.
tsc/testdata/baselines/reference/conformance/conditionalTypes1.errors.txt Confirms no new diagnostics.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

feditfear123

This comment was marked as abuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

3 participants