Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Andarist
Copy link
Contributor

fixes #56738

@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
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.

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: Waiting on reviewers
Development

Successfully merging this pull request may close these issues.

Abstract property specified on multiple classes loses modifier after intersection
3 participants