Created
May 31, 2020 09:00
-
-
Save GitaiQAQ/cd9dfbde7f4222b87d5b22f2557a5d9c to your computer and use it in GitHub Desktop.
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
| 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