Skip to content

Conversation

Andarist
Copy link
Contributor

@Andarist Andarist commented Mar 4, 2025

fixes #61344

@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Mar 4, 2025
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Mar 4, 2025
Comment on lines +39012 to +39015
if (checkFlags & CheckFlags.Synthetic) {
// unions and intersections eagerly compute Readonly flag on creation
return !!(checkFlags & CheckFlags.Readonly);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The issue arised because getDeclarationModifierFlagsFromSymbol(symbol) was returning ModifierFlags.Readonly based on the .valueDeclaration.
  2. .valueDeclaration is only set on union/intersection properties when it's "uniform"(ish). In this example, one source property symbol had a .valueDeclaration and the other one hadn't (the one from the mapped type hadn't it)
  3. but given that, as the existing comment states, the readonly flag is precomputed eagerly for union/intersections - this is really the only thing the compiler has to check in that situation. So I leveraged that for the fix here.

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.

Intersection for same key read-only property maybe wrong

2 participants