-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Separate intersection type resolution process for publicly and non-publicly accessible mixin construct signatures #45810
Conversation
…ccessible mixin constructor signatures
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the implementation looks like an improvement - I feel like a lot of this implementation is relying on us only considering mixins actually mixins if they only have exactly one construct signature - but I guess for now that's a safe enough assumption to make, seeing as we make it elsewhere. Maybe @ahejlsberg would have a more nuanced opinion about how different constructor visibilities should interact, but combining only all the public ones (while keeping the private signatures in for relationships' sake) seems fine to me. The inheritance of protected
construct signatures from mixins might be a little odd in practice, though (I think you'd be able to use a protected
mixin constructor signature so long as you're constructing a subtype instance within a subtype of the class you're mixing, which might be weird and way too loose).
@andrewbranch up to you if this should hit the beta/rc pipeline or be held longer/discussed at some point~
Looks like a breaking change, so we’ll at least hold off until 4.6, which should give us some time to talk about it some and see if anyone else has feedback. |
@weswigham your review on this is very old, but it was positive. Should we take this change after all? |
This PR is now two years old. @weswigham @andrewbranch do you think this is worth taking? I'm not sure if it needs more discussion or if we just forgot about it. |
I'm going to close this for now since it's quite stale. |
Fixes #42264
In
checker.ts > resolveIntersectionTypeMembers()
, instead of discarding and merging all mixin constructor signatures, we do so only for mixins with publicly accessible constructor signatures. Private or protected constructor signatures of mixins are not discarded/merged, and instead are added to the intersection type's constructor signatures.Details on bug cause are provided in my comment to the bug report.