Skip to content

Instantly share code, notes, and snippets.

@GitaiQAQ
Created May 31, 2020 09:00
Show Gist options
  • Select an option

  • Save GitaiQAQ/cd9dfbde7f4222b87d5b22f2557a5d9c to your computer and use it in GitHub Desktop.

Select an option

Save GitaiQAQ/cd9dfbde7f4222b87d5b22f2557a5d9c to your computer and use it in GitHub Desktop.
interface Test<T> {
g?: Test<T>;
}
function mixinPerson<T extends Constructor<{}>>(Base: T) {
return class Base {
constructor(public name: string) { }
}
}
function mixinPersonWithTest<T extends Constructor<{}>>(Base: T) {
return class Base implements Test<T> {
g?: Test<T>;
constructor(public name: string) { }
}
}
type Constructor<T> = new (...args: any[]) => T;
function Tagged<T extends Constructor<Test<{}>>>(Base: T) {
return class extends Base {
_tag: string;
constructor(...args: any[]) {
super(...args);
this._tag = "";
this.g?.g?.g?.g?.g
}
}
}
class Customer extends Tagged(mixinPersonWithTest(Object)) {
accountBalance: number = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment