Skip to content

Commit

Permalink
Fix support for ky.stop as return type in BeforeRetryHook TypeScr…
Browse files Browse the repository at this point in the history
…ipt type (#307)
  • Loading branch information
rururux committed Dec 20, 2020
1 parent 87c94fd commit b86ff0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type BeforeRetryHook = (options: {
options: NormalizedOptions;
error: Error;
retryCount: number;
}) => void | Promise<void>;
}) => typeof ky.stop | void | Promise<typeof ky.stop | void>;

export type AfterResponseHook = (
request: Request,
Expand Down
6 changes: 6 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ ky(url, {
expectType<Error>(error);
expectType<number>(retryCount);
request.headers.set('foo', 'bar');
},
(_options) => {
return ky.stop;
},
async (_options) => {
return ky.stop;
}
],
afterResponse: [
Expand Down

0 comments on commit b86ff0a

Please sign in to comment.