Skip to content

Conversation

@Andarist
Copy link
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
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

3 participants