/** * Mixes all own properties of all baseCtors into the derivedCtor. * See https://www.typescriptlang.org/docs/handbook/mixins.html */ export function applyMixins(derivedCtor: any, baseCtors: any[]): void { baseCtors.forEach(baseCtor => { Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => { Object.defineProperty( derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ); }); }); }