Typescript mixin and how to use it.
Declaring mixin in typescript
type Constructor<T = {}> = new (...args: any[]) => T;
function Handler<BaseType extends Constructor>(TargetType: BaseType) {
return class extends TargetType {
isActivated = false;
};
}
class User {
name = ""
}
const i = Handler(User);
const idec = new i
Comments