Skip to content

Fix union overload signature ordering instability - #64360

Open
ADİL ALPEREN ÇİFTCİ (adilalperenciftci) wants to merge 1 commit into
microsoft:mainfrom
adilalperenciftci:fix/53614-union-overload-instability
Open

ADİL ALPEREN ÇİFTCİ (adilalperenciftci) wants to merge 1 commit into
microsoft:mainfrom
adilalperenciftci:fix/53614-union-overload-instability

Conversation

@adilalperenciftci

Copy link
Copy Markdown

Fixes #53614

this pr makes union overlaod resolution prefer a strictly more specfic signature when two compatble non generic signatures r directly comparable.

ive updated getunionsignatures in tsc/internal/checker/checker.go so that a more specific signature is placed before a less specific one while keeping the existing order for unrelated ones.

signatures are only reordered when their param counts, min arg counts, rest param shape and explicit this types are compatible and one signatures param types are strictly more specfic than the other.

also added some regression coverage in tsc/testdata/.../unionoverloadsignatureorder.ts for unprimed and primed cases, both union orders, revrsed decl order, multiple overloads and valid/invalid calls along with the compiler baselines

Copilot AI balanced review requested due to automatic review settings September 20, 2026 07:02
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 20, 2026
@typescript-automation typescript-automation Bot added For Backlog Bug PRs that fix a backlog bug labels Sep 20, 2026

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 was unable to review this pull request because the user who requested the review has reached their quota limit.

@adilalperenciftci

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Inconsistent errors reported between tsc and VSCode (Unions across objects with method overload definitions)

2 participants