I've read this article. https://justinfagnani.com/2015/12/21/real-mixins-with-javascript-classes/
here is the original code of JavaScript from the article:
class MyClass extends mix(MyBaseClass).with(Mixin1, Mixin2) {
/* ... */
}
let mix = (superclass) => new MixinBuilder(superclass);
class MixinBuilder {
constructor(superclass) {
this.superclass = superclass;
}
with(...mixins) {
return mixins.reduce((c, mixin) => mixin(c), this.superclass);
}
}
I'm wondering how to create such a mixin utility helper in typescript so I can get the type hitting and static code analysis.
I've been tried hours... but couldn't finish it without using some any types, if I use any I miss all the type hints, which is not what I want.