Skip to content

Commit

Permalink
Fix types: Allow promises in afterResponse hook (#883)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaulz authored and sindresorhus committed Sep 20, 2019
1 parent f59a563 commit d0c2f05
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source/known-hook-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Called with [response object](https://github.com/sindresorhus/got#response) and
Each function should return the response. This is especially useful when you want to refresh an access token.
*/
export type AfterResponseHook = (response: Response, retryWithMergedOptions: (options: NormalizedOptions) => CancelableRequest<Response>) => Response | CancelableRequest<Response>;
export type AfterResponseHook = (response: Response, retryWithMergedOptions: (options: NormalizedOptions) => CancelableRequest<Response>) => Response | CancelableRequest<Response> | Promise<Response | CancelableRequest<Response>>;

export type HookType =
| BeforeErrorHook
Expand Down

0 comments on commit d0c2f05

Please sign in to comment.