-
Notifications
You must be signed in to change notification settings - Fork 39
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
How to work with the mixins helper function in vue-class-compoment? #20
Comments
same problem |
@zhiquan-yu Have you solved it, please? |
@djkloop Because we are using JSX, maybe we should use HOC like React instead of mixin. Reference: https://github.com/MeetehS/vue-class-ts/blob/master/docs/mixins.md |
Currently not supported. We must specify types manually. import Vue from "vue";
import Component, { mixins } from "vue-class-component";
import { Prop } from "vue-property-decorator";
import * as tsx from "vue-tsx-support";
interface MyMixinProps {
foo: string;
}
@Component
class MyMixin extends Vue {
@Prop
foo!: string;
}
@Component
class MyComp extends mixins(MyMixin) {
@Prop
bar!: string;
}
const TypedMyComp = tsx.ofType<{ bar: string } & MyMixinProps>().convert(MyComp); |
@wonderful-panda In the future, there will be related apis in this area... I feel this @Mixins Api is very practical... |
I managed to use something like
By overriding the declarations of mixins from vue-class-component. I’m considering opening a PR but I would need to add vue-class-component as a peerDependency I think... @wonderful-panda do you think this could be done? Or would you prefer if I maybe added the solution somewhere in the docs? I managed to fix by adding this vue-class-component-extender.d.ts file:
|
vue-class-component: using mixins
The text was updated successfully, but these errors were encountered: