-
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
Allow inheritance from intersections #14075
Comments
You're confusing types and expressions in your example. The class A { a = 1 }
class B { b = 2 }
declare const Both: new () => A & B;
class D extends Both { } This of course omits the details of how The declaration file emitter currently depends on the fact that a class declares both a type and a value. It actually emits the |
Allowing a type in an ambient declaration should be fine though. |
Not sure how that would work. First, it would be ambiguous how to parse it. Second, we require an expression of a constructor type, not an instance type, so you couldn't just write |
Either we allow inheriting from types in ambient declarations, or we need to write a |
Based on #14017, when exporting a class that extends from a mixin, the emitted type contains an intersection. Inheriting from an intersection is not allowed, even though it should be.
Note that inheriting from a type alias of an intersection already works:
Expected behavior:
No error for C or D.
Actual behavior:
Error for C.
The text was updated successfully, but these errors were encountered: