export interface IPromiseMapper { /** * Map all the given source to targets. */ list(source: Promise): Promise; /** * Actual mapper. */ map(source: TSource): Promise; mapNull(source?: TSource | null): Promise; } export namespace PromiseMapperInfer { export type Source = T extends IPromiseMapper ? TSource : T; export type Target = T extends IPromiseMapper ? TTarget : T; }