export type IAsyncFunc = (...args: any) => Promise | any; type IPromiseType = T extends PromiseLike ? U : T; type RestParameters any> = T extends (...args: infer P) => any ? P : []; type IApiHandlers = { [api: string]: IAsyncFunc; }; export default IApiHandlers; type IApi = { args: RestParameters; result: IPromiseType>; }; export type IApiSchema = { [command: string]: { args: any; result: any; }; }; export type IApiSpec = { [key in keyof Handlers]: IApi; };