Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix thenReject and thenThrow types
They should support sequential return values.
  • Loading branch information
jthieman committed Nov 13, 2023
1 parent 102c53c commit 3369a0c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.d.ts
Expand Up @@ -56,17 +56,17 @@ export const matchers: Matchers;
export interface Stubber<D, R = D extends object ? Partial<D> : D> {
thenReturn<T>(first: R, ...args: Array<R>): TestDouble<T>;
thenDo<T>(f: Function): TestDouble<T>;
thenThrow<T>(e: any): TestDouble<T>;
thenThrow<T>(first: unknown, ...args: Array<unknown>): TestDouble<T>;
thenResolve<T>(first: R, ...args: Array<R>): TestDouble<T>;
thenReject<T>(e: any): TestDouble<T>;
thenReject<T>(first: unknown, ...args: Array<unknown>): TestDouble<T>;
thenCallback<T>(error: any, data: any): TestDouble<T>;
}

export interface PromiseStubber<P, R = P extends object ? Partial<P> : P> {
thenReturn<T>(first: Promise<R>, ...args: Array<Promise<R>>): TestDouble<T>;
thenResolve<T>(first: R, ...args: Array<R>): TestDouble<T>;
thenDo<T>(f: Function): TestDouble<T>;
thenReject<T>(e: any): TestDouble<T>;
thenReject<T>(first: unknown, ...args: Array<unknown>): TestDouble<T>;
}

export interface TestdoubleConfig {
Expand Down

0 comments on commit 3369a0c

Please sign in to comment.