UNPKG

@affinidi/tools-openapi

Version:
7 lines (6 loc) 874 B
declare type BasicResultFunction = (this: any, ...rest: any) => Promise<any>; declare type PromisedReturnType<TFunction extends BasicResultFunction> = TFunction extends (this: any, ...rest: any) => Promise<infer U> ? U : never; declare type InputFunction<TResultFunction extends BasicResultFunction> = (self: ThisParameterType<TResultFunction>, ...rest: Parameters<TResultFunction>) => Promise<PromisedReturnType<TResultFunction>>; declare type InputMapper<TSource extends Record<string, unknown>, TResultFunction extends BasicResultFunction> = (value: TSource[keyof TSource], key: keyof TSource) => InputFunction<TResultFunction>; export declare const mapFunctions: <TSource extends Record<string, unknown>, TResultFunction extends BasicResultFunction>(obj: TSource, inputMapper: InputMapper<TSource, TResultFunction>) => Record<keyof TSource, TResultFunction>; export {};