Fixed match definition for mobx-task (#34826)

This commit is contained in:
JulianWielga
2019-04-19 00:48:08 +02:00
committed by Armando Aguirre
parent 94adcfc50d
commit cf4e423b4e

View File

@@ -18,10 +18,10 @@ export interface TaskOptions<Result> {
swallow?: boolean;
}
export interface TaskMatchProps<Args extends any[], TaskMatchResult, Result = any> {
pending: (...args: Args) => TaskMatchResult;
rejected: (error: TaskError) => TaskMatchResult;
resolved: (result: Result) => TaskMatchResult;
export interface TaskMatchProps<T1, T2, T3, Args extends any[], Result = any> {
pending: (...args: Args) => T1;
rejected: (error: TaskError) => T2;
resolved: (result: Result) => T3;
}
export interface TaskStatusAware<Result = any, Args extends any[] = any[]> extends TaskFunc<Promise<Result>, Args> {
@@ -33,7 +33,7 @@ export interface TaskStatusAware<Result = any, Args extends any[] = any[]> exten
readonly result?: Result;
readonly error?: TaskError;
match<TaskMatchResult>(props: TaskMatchProps<Args, TaskMatchResult, Result>): TaskMatchResult;
match<PendingType, RejectedType, ResolvedType>(props: TaskMatchProps<PendingType, RejectedType, ResolvedType, Args, Result>): PendingType | RejectedType | ResolvedType;
wrap<R, A extends any[]>(func: (inner: TaskStatusAware<Result, Args>) => (...args: A) => Promise<R>): TaskStatusAware<R, A>;