This mixin is borrowed from https://github.com/1nVitr0/lib-ts-mixin-extended , I want write a mixin function also has mixins, for nested I mean
function createBarFields() {
return <TBase extends Constructor>(Base: TBase) => {
class HasBarMixin extends mixin(Base, withFooFields) {
bar?: string = 'bar';
}
return HasBarMixin;
};
}
This will report
Type is not a constructor function type.(2507)
If I force the result like MixinReturnValue<T, M> & Constructor
, the error is gone, but the result type missing the field foo
, How can I make this right, is this possible ?
Playground