Skip to content

Fixed an issue with intersected abstract properties not requiring to be implemented#56751

Closed
Andarist wants to merge 6 commits intomicrosoft:mainfrom
Andarist:fix/intersected-abstract-props
Closed

Fixed an issue with intersected abstract properties not requiring to be implemented#56751
Andarist wants to merge 6 commits intomicrosoft:mainfrom
Andarist:fix/intersected-abstract-props

Conversation

@Andarist
Copy link
Copy Markdown
Contributor

@Andarist Andarist commented Dec 12, 2023

fixes #56738
fixes #62014

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Dec 12, 2023
@Andarist Andarist marked this pull request as draft December 12, 2023 18:34
@Andarist Andarist marked this pull request as ready for review December 26, 2023 17:02
}
const result = getIntersectionType(types);
if (result.flags & TypeFlags.Intersection) {
(result as IntersectionType).withThisArgumentTarget = intersectionType;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The problem that it solves is that getTypeWithThisArgument call for the Bar1 creates a new intersection type, one that doesn't have any reference (through .target or similar) to the "original" intersection (the base type).

So createUnionOrIntersectionProperty creates 2 separate synthetic properties for a for both the base type and the derived type (even though they both refer to the same symbols, declarations, etc). That, in turn, fails derived === base check that is responsible for checking if the property was implemented or not.

This introduces some kind of a link between those types so I can trace this information back through the symbol links.

It's not a super elegant solution but it's the best I was able to figure out. I've tried to cache those property symbols and reuse them between both of those types but that led to a lot of problems. An alternative solution would be to make the mentioned derived === base check smarter but I also failed to figure out how to accurately compare 2 symbols like that.

@github-project-automation github-project-automation bot moved this from Waiting on reviewers to Done in PR Backlog Mar 24, 2026
@typescript-bot
Copy link
Copy Markdown
Collaborator

With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies).

Next steps for PRs:

  • For crash bugfixes or language service improvements, PRs are currently accepted at the typescript-go repo
  • Changes to type system behavior should wait until after 7.0, at which point mainline TypeScript development will resume in this repository with the Go codebase
  • Library file updates (lib.d.ts etc) continue to live in this repo or the DOM Generator repo as appropriate

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: Done

5 participants