Skip to content

Instantly share code, notes, and snippets.

@appsforartists
Created April 1, 2017 00:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save appsforartists/dd8f07e0c7c78f14e08e4c2647737fd2 to your computer and use it in GitHub Desktop.
Save appsforartists/dd8f07e0c7c78f14e08e4c2647737fd2 to your computer and use it in GitHub Desktop.
export type Constructor<T> = new(...args: any[]) => T;
export interface B {
fromB(): void;
}
export function withB<T extends Constructor<object>>(superclass: T): Constructor<B> {
return class B extends superclass {
fromB() {
}
};
}
export class A extends withB(C) {
}
export class C { }
const a = new A();
a.fromB();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment