Skip to content

Commit

Permalink
Fix TypeScript types to allow hooks to return a Promise (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
etienne-dldc authored and sindresorhus committed Apr 9, 2019
1 parent 8d295b0 commit bc6aa04
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export type JSONValue = string | number | boolean | null | JSONObject | JSONArra

export type JSONStringifyable = string | number | boolean | null | object;

export type BeforeRequestHook = (options: Options) => void;
export type BeforeRequestHook = (options: Options) => void | Promise<void>;

export type AfterResponseHook = (response: Response) => Response | void;
export type AfterResponseHook = (response: Response) => Response | void | Promise<Response | void>;

export interface Hooks {
/**
Expand Down

0 comments on commit bc6aa04

Please sign in to comment.