Skip to content

Port #61683: Use getNonMissingTypeOfSymbol in compareProperties#2726

Merged
jakebailey merged 3 commits intomainfrom
copilot/port-compare-properties-fix
Feb 10, 2026
Merged

Port #61683: Use getNonMissingTypeOfSymbol in compareProperties#2726
jakebailey merged 3 commits intomainfrom
copilot/port-compare-properties-fix

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

  • Change getTypeOfSymbol to getNonMissingTypeOfSymbol in compareProperties function (checker.go:27072)
  • Build and verify the change compiles
  • Run full test suite and accept all baseline changes
  • exactOptionalPropertyTypesIdentical baseline accepted
  • multipleBaseInterfaesWithIncompatibleProperties2 (exactoptionalpropertytypes=true) baseline accepted — diff file deleted (output now matches TS reference)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…operties

Don't compare "missing" to undefined in compareProperties under
exactOptionalPropertyTypes. This changes getTypeOfSymbol to
getNonMissingTypeOfSymbol for both source and target properties
in the compareProperties function.

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI changed the title [WIP] Port fix for comparing missing to undefined in compareProperties Port #61683: Use getNonMissingTypeOfSymbol in compareProperties Feb 10, 2026
Copilot AI requested a review from jakebailey February 10, 2026 21:44
@jakebailey jakebailey marked this pull request as ready for review February 10, 2026 21:44
Copilot AI review requested due to automatic review settings February 10, 2026 21:44
Copy link
Contributor

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 ports microsoft/TypeScript#61683 to fix a bug in property comparison under exactOptionalPropertyTypes mode. The issue caused optional properties with and without explicit | undefined to be incorrectly treated as identical in conditional type resolution.

Changes:

  • Updated compareProperties to use getNonMissingTypeOfSymbol instead of getTypeOfSymbol to properly strip the internal "missing" type marker before comparison
  • Added test baseline showing the now-correctly-detected type error for the scenario described in the issue

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
internal/checker/checker.go Changed property type comparison to use getNonMissingTypeOfSymbol for both source and target properties
testdata/baselines/reference/submodule/compiler/exactOptionalPropertyTypesIdentical.errors.txt Added expected error output showing the fix correctly detects type incompatibility
testdata/baselines/reference/submodule/compiler/exactOptionalPropertyTypesIdentical.errors.txt.diff Removed the diff file indicating no previous errors were expected

@jakebailey
Copy link
Member

@copilot You still need to run the tests and accept all baseline changes

Accept baseline for multipleBaseInterfaesWithIncompatibleProperties2
with exactoptionalpropertytypes=true, which now correctly reports
TS2320 error matching the TypeScript reference.

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 10, 2026

@copilot You still need to run the tests and accept all baseline changes

Ran the full test suite and accepted all baseline changes in 0683d859. There was one additional test affected: multipleBaseInterfaesWithIncompatibleProperties2(exactoptionalpropertytypes=true) — its .diff file was deleted because our output now correctly matches the TypeScript reference baseline. All tests pass.

@jakebailey jakebailey enabled auto-merge February 10, 2026 22:18
@jakebailey jakebailey added this pull request to the merge queue Feb 10, 2026
Merged via the queue into main with commit bb53aa4 Feb 10, 2026
20 checks passed
@jakebailey jakebailey deleted the copilot/port-compare-properties-fix branch February 10, 2026 22:44
Copilot AI added a commit that referenced this pull request Feb 25, 2026
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants