From e4a43843096117c31726c1ca4e15b99d301ca441 Mon Sep 17 00:00:00 2001 From: Filipe Medeiros Date: Fri, 22 Jan 2021 19:12:46 +0000 Subject: [PATCH 1/2] feat: add generic to AfterResponseHook Adding a generic parameter to the AfterResponseHook type allows us to type the response and avoid an unknown if the user knows the response type. --- source/as-promise/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/as-promise/types.ts b/source/as-promise/types.ts index c4572d9fc..f119071c9 100644 --- a/source/as-promise/types.ts +++ b/source/as-promise/types.ts @@ -121,7 +121,7 @@ export interface PaginationOptions { }; } -export type AfterResponseHook = (response: Response, retryWithMergedOptions: (options: Options) => CancelableRequest) => Response | CancelableRequest | Promise>; +export type AfterResponseHook = (response: Response, retryWithMergedOptions: (options: Options) => CancelableRequest) => Response | CancelableRequest | Promise>; // These should be merged into Options in core/index.ts export namespace PromiseOnly { From 325fc827eea69a3d1b05308fe5f1d13694113a86 Mon Sep 17 00:00:00 2001 From: Filipe Medeiros Date: Wed, 27 Jan 2021 18:47:17 +0000 Subject: [PATCH 2/2] chore: rename generic type Co-authored-by: Sindre Sorhus --- source/as-promise/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/as-promise/types.ts b/source/as-promise/types.ts index f119071c9..aa52695bd 100644 --- a/source/as-promise/types.ts +++ b/source/as-promise/types.ts @@ -121,7 +121,7 @@ export interface PaginationOptions { }; } -export type AfterResponseHook = (response: Response, retryWithMergedOptions: (options: Options) => CancelableRequest) => Response | CancelableRequest | Promise>; +export type AfterResponseHook = (response: Response, retryWithMergedOptions: (options: Options) => CancelableRequest) => Response | CancelableRequest | Promise>; // These should be merged into Options in core/index.ts export namespace PromiseOnly {