Skip to content

Ensure stable ordering in getInferTypeParameters result - #64621

Merged
Anders Hejlsberg (ahejlsberg) merged 2 commits into
mainfrom
fix-64589
Oct 3, 2026
Merged

Anders Hejlsberg (ahejlsberg) merged 2 commits into
mainfrom
fix-64589

Conversation

@ahejlsberg

Copy link
Copy Markdown
Member

Fixes #64589.

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.

Copilot review overview

🟢 Approval recommended

The deterministic sort directly addresses the unordered symbol-table iteration, with focused regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Ensures deterministic declaration emit by stably ordering inferred type parameters before constructing type mappers.

Changes:

  • Sorts inferred type parameters using CompareTypes.
  • Adds a regression test and declaration/type/symbol baselines for #64589.
File Description
tsc/​internal/​checker/​checker.go Stabilizes inferred type-parameter ordering.
tsc/​testdata/​tests/​cases/​compiler/​stableTypeMapperOrdering.ts Adds the regression case.
tsc/​testdata/​baselines/​reference/​compiler/​stableTypeMapperOrdering.js Captures emit and declaration output.
tsc/​testdata/​baselines/​reference/​compiler/​stableTypeMapperOrdering.types Captures inferred types.
tsc/​testdata/​baselines/​reference/​compiler/​stableTypeMapperOrdering.symbols Captures resolved symbols.

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

@ahejlsberg
Anders Hejlsberg (ahejlsberg) added this pull request to the merge queue Oct 3, 2026
Merged via the queue into main with commit 50d70a3 Oct 3, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

TS 7: declaration emit prints union members in a different order from run to run

3 participants