-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Decorators within mixins #14607
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
Comments
We got into same issues here https://github.com/wc-catalogue/blaze-elements/blob/master/packages/common/mixins.ts#L10 the quickfix is easy just define the mixin class and return it afterwards: type Constructor<T> = { new (...args: any[]): T }
function Mixin<T extends Constructor<{}>>(Base : T) {
class MixinClass extends Base {
constructor(...args: any[]) {
super(...args)
}
@decorator
get y() {
return this.x + 3
}
}
return MixinClass;
} |
Ah, Wonderful! Thanks! |
Hmm I would rather keep it open to get core team opinion on this cc @RyanCavanaugh @DanielRosenwasser - if it's desing limitation or bug. thx! |
True. |
See #7342 |
I think the idea that decorators can inform the type system of changes that it may be performing is something we will be considering over time. |
Cool so I guess we can close this and reference the hotfix to #7342 ? |
Sorry, I misread this. My previous comment has nothing to do with this, but yeah, looks like #7432 seems like the right place to discuss the issue. |
I wonder if there's any plans to support decorators within mixins?
TSC 2.2.1 currently rejects this construction: [Decorators are not valid here]
The text was updated successfully, but these errors were encountered: