Mixin extends another Mixin in Typescript

80 views Asked by At

I have the following mixin:

type Constructor<T> = new (...args: any[]) => T;

export declare class MixknAInterface {
    // methods goes here
}

export const MixinA = <T extends Constructor<LitElement>>(superclass: T) => {
    class MixinAClass extends superclass {
        ...
    }
    return MixinAClass as unknown as Constructor<MixknAInterface> & T;
}

And this is how one component extends it:

export class ClassA extends MixinA(LitElement) {...}

But what if I want to create another mixin MixinB that extends MixinA so that I can have a component extending on MixinB and MixinA like

export class ClassB extends MixinB.....

How should I create MixinB?

0

There are 0 answers