问题描述
我想编写一个包装mixin的实用程序。经过一番思考,我意识到递归将是最短的方法,但是某些方法不起作用
export function mixin<TBase extends Constructor>(Base: TBase[],count = 0): TBase {
const currentClass = Base[count];
if (count === Base.length - 1) {
return class extends currentClass {};
} else {
count++;
return class extends mixin(Base,count) {};
}
}
// it should look like this
// return class extends one
// return class extends two
// return class extends three
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)