Skip to content

Conversation

@ahejlsberg
Copy link
Member

This is a port of microsoft/TypeScript#61903.

Fixes #1222.

Copilot AI review requested due to automatic review settings June 25, 2025 15:18
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 the fix from the TypeScript repo to use a strict subtype relation in the getCommonSupertype functionality, addressing issue #1222. Key changes include:

  • Adding a test case (strictBestCommonSupertype.ts) to validate the fix.
  • Updating baseline output files (types and symbols) to reflect the new behavior.
  • Refactoring the common supertype computation in internal/checker/inference.go to use a dedicated getSingleCommonSupertype helper.

Reviewed Changes

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

File Description
testdata/tests/cases/compiler/strictBestCommonSupertype.ts New test case verifying the strict subtype logic for selecting a common supertype.
testdata/baselines/reference/compiler/strictBestCommonSupertype.types Updated expected types baseline to match the new algorithm output.
testdata/baselines/reference/compiler/strictBestCommonSupertype.symbols Updated expected symbols baseline reflecting changes in type resolution.
internal/checker/inference.go Refactored common supertype logic to use getSingleCommonSupertype for stricter subtype validation.

@ahejlsberg ahejlsberg requested a review from jakebailey June 25, 2025 15:18
@ahejlsberg ahejlsberg added this pull request to the merge queue Jun 25, 2025
Merged via the queue into main with commit ed795b2 Jun 25, 2025
22 checks passed
@ahejlsberg ahejlsberg deleted the strict-best-common-supertype branch June 25, 2025 21:29
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.

Type inference broken with angular inject function + @ngrx/store

3 participants