Skip to content

Conversation

ahejlsberg
Copy link
Member

Fixes #1761.

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 reverts a change in the type checker to fix issue #1761 related to fresh object literal subtype checking. The change replaces an object flags check with a call to isObjectLiteralType() function.

  • Reverts object flags check back to isObjectLiteralType() function call in the relater
  • Adds comprehensive test case covering the specific scenario from issue #1761
  • Updates test baselines to reflect the corrected type checking behavior

Reviewed Changes

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

File Description
internal/checker/relater.go Reverts condition from ObjectFlagsFreshLiteral flag check to isObjectLiteralType() function call
testdata/tests/cases/compiler/freshObjectLiteralSubtype.ts Adds test case with object literal subtyping scenario and enables @target: esnext
testdata/baselines/reference/compiler/freshObjectLiteralSubtype.types Updates type inference baselines for the new test case
testdata/baselines/reference/compiler/freshObjectLiteralSubtype.symbols Updates symbol resolution baselines including Math symbol declarations

@jakebailey
Copy link
Member

Strada also needs this fix too now, after microsoft/TypeScript#62502, right?

@ahejlsberg
Copy link
Member Author

Strada also needs this fix too now, after microsoft/TypeScript#62502, right?

Yes, I'll be putting up a PR.

@ahejlsberg ahejlsberg added this pull request to the merge queue Sep 29, 2025
Merged via the queue into main with commit b328a8f Sep 29, 2025
22 checks passed
@ahejlsberg ahejlsberg deleted the fix-1761 branch September 29, 2025 18:19
ahejlsberg added a commit to microsoft/TypeScript that referenced this pull request Sep 29, 2025
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.

Object literal may only specify known properties, and 'property' does not exist in type SomeType
2 participants