Skip to content

Instantly share code, notes, and snippets.

@ArtemAvramenko
Last active November 29, 2018 10:01
Show Gist options
  • Save ArtemAvramenko/00eb17a9ab2436b778c99ef955add163 to your computer and use it in GitHub Desktop.
Save ArtemAvramenko/00eb17a9ab2436b778c99ef955add163 to your computer and use it in GitHub Desktop.
TypeScript mixins
const MixinHello = <T extends new (...args: any[]) => A>(base: T) =>
class extends base {
hello() { }
};
class A {
a() { }
}
class B extends A {
b() { }
}
class C extends MixinHello(B) {
c() { }
}
let x = new C();
x.a();
x.b();
x.c();
x.hello();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment