Created
October 28, 2019 11:28
-
-
Save alexeychikk/f3629ca25fd2e1f29f6784256e5fbe1c to your computer and use it in GitHub Desktop.
Revisions
-
alexeychikk created this gist
Oct 28, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ // tslint:disable: no-any export type Thunkify< Actions extends { [key: string]: (...args: any) => any } > = { [actionKey in keyof Actions]: ReturnType<Actions[actionKey]> extends (( ...args: any ) => Promise<any>) ? | (( ...args: Parameters<Actions[actionKey]> ) => ReturnType<ReturnType<Actions[actionKey]>>) | Actions[actionKey] : Actions[actionKey] }; // tslint:enable: no-any