Skip to content

Conversation

ahejlsberg
Copy link
Member

This fixes microsoft/TypeScript#16861 in a slightly different manner than in the old compiler. We already had a failing test which now passes.

@Copilot Copilot AI review requested due to automatic review settings October 1, 2025 13:45
Copy link
Contributor

@Copilot 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 fixes a bug in the TypeScript compiler where circular constraints were causing incorrect type resolution, specifically addressing issue #16861. The fix ensures that member resolution is properly reset after base type resolution to handle cases where type parameter defaults cause circularity errors.

  • Resets member resolution flags after base type resolution to prevent stale partial resolution
  • Removes outdated suspicious logic from resolveBaseTypesOfClass that was commented out
  • Updates test baselines to reflect corrected type resolution behavior

Reviewed Changes

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

File Description
internal/checker/checker.go Adds member resolution reset logic in getBaseTypes and removes commented-out suspicious code in resolveBaseTypesOfClass
testdata/baselines/reference/submodule/compiler/circularConstraintYieldsAppropriateError.* Updates test baselines showing the fix now properly resolves types instead of falling back to any, and reduces errors from 2 to 1

@ahejlsberg ahejlsberg requested a review from jakebailey October 1, 2025 13:46
@ahejlsberg ahejlsberg enabled auto-merge October 1, 2025 14:32
@ahejlsberg ahejlsberg added this pull request to the merge queue Oct 1, 2025
Merged via the queue into main with commit 6524ca6 Oct 1, 2025
39 of 41 checks passed
@ahejlsberg ahejlsberg deleted the fix-ts-16861 branch October 1, 2025 14:41
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.

tsc TypeError: Cannot read property 'flags' of undefined

2 participants