Mixins props is marked as required by typescript even tho I defined it as optional
Closed this issue · 7 comments
chanlito commented
eshimischi commented
import * as tsx from "vue-tsx-support"; import p from "vue-strict-prop"; const Flex = tsx.mixin(textXsCenterMixin).create({ props: { textXsCenter: p(Boolean).optional, }, });
chanlito commented
@eshimischi If i do that, i'm just duplicating the mixin.
eshimischi commented
const textXsCenterMixin should only consist of methods in that case, not props as you did above
chanlito commented
Why not?
eshimischi commented
@chanlito Once again look to @wonderful-panda Examples.. https://github.com/wonderful-panda/vue-tsx-support#mixin
wonderful-panda commented
@chanlito If you want to use props in mixin, you must use tsx.component
with mixin declaration.
import * as tsx from "vue-tsx-support";
export const textXsCenterMixin = tsx.component({
props: {
textXsCenter: PropTypes(Boolean).optional,
},
});
const Flex = componentFactory.mixin(textXsCenterMixin).create({ //...
chanlito commented
@wonderful-panda That works! Cheers.