Created
April 10, 2018 18:18
-
-
Save robertleeplummerjr/26e5066009b7573c38293feaaefa67de 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
| class StaticBridge { | |
| public static build<T>(Type: T, c: Api): any { | |
| return Object.getOwnPropertyNames(Type) | |
| .filter((prop) => typeof Type[prop] === "function") | |
| .reduce((methods, method) => ({ | |
| // tslint:disable-next-line:no-any | |
| ...methods as any, | |
| [method]: async (v: any): Promise<any> => { | |
| return Type[method](v, c); | |
| }, | |
| }), {}); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment