Last active
November 29, 2018 10:01
-
-
Save ArtemAvramenko/00eb17a9ab2436b778c99ef955add163 to your computer and use it in GitHub Desktop.
TypeScript mixins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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