Closed thorning closed 7 years ago
Thanks for reporting! I will take a look.
Strangely I cannot reproduce. Could you provide an example with ComponentsWithMixin and ComponentsWithoutMixin definition?
The following compiles in ts 2.3.2 but not in 2.4.2 for me:
@Trait class TestTrait extends Vue {}
@Component({
name : 'mixin-component'
})
class MixinComponent extends Mixin(TestTrait) {
}
@Component({
name : 'depend-on-mixin-component',
components : {
MixinComponent
}
})
class DependOnMixin extends Vue {
}
I get the following error in 2.4.2:
Argument of type '{ name: string; components: { MixinComponent: typeof MixinComponent; }; }' is not assignable to parameter of type 'ComponentOptions<Vue> | undefined'.
Type '{ name: string; components: { MixinComponent: typeof MixinComponent; }; }' is not assignable to type 'ComponentOptions<Vue>'.
Types of property 'components' are incompatible.
Type '{ MixinComponent: typeof MixinComponent; }' is not assignable to type '{ [key: string]: typeof Vue | ComponentOptions<Vue> | FunctionalComponentOptions | AsyncComponent...'.
Type '{ MixinComponent: typeof MixinComponent; }' is not assignable to type '{ [key: string]: typeof Vue | ComponentOptions<Vue> | FunctionalComponentOptions | AsyncComponent...'.
Property 'MixinComponent' is incompatible with index signature.
Type 'typeof MixinComponent' is not assignable to type 'typeof Vue | ComponentOptions<Vue> | FunctionalComponentOptions | AsyncComponent'.
Type 'typeof MixinComponent' is not assignable to type 'AsyncComponent'.
Type 'typeof MixinComponent' provides no match for the signature '(resolve: (component: Component) => void, reject: (reason?: any) => void): void | typeof Vue | ComponentOptions<Vue> | FunctionalComponentOptions | Promise<Component>'.
I tried looking though the definitions, but not quite sure what the problem is. It might be that VClass, which the Mixin function returns, does not extend Vue or ComponentOption
It seems quite hard to fix. The problem is mixin pattern cannot handle static property well...
I come up with a method to add static method! Released as 0.9.1.
I think some of the changes to type definition in 2.4 broke the mixin ts 2.4.
Both work if I revert ts to 2.3.