From c44276619505f0e942f0f4c210548afd4ec3364d Mon Sep 17 00:00:00 2001 From: "@zheng.yufan" <3065702781@qq.com> Date: Thu, 22 Sep 2022 19:01:39 +0800 Subject: [PATCH 1/2] add union type to onRequest --- src/fetch.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fetch.ts b/src/fetch.ts index 214593e..586f6ac 100644 --- a/src/fetch.ts +++ b/src/fetch.ts @@ -33,7 +33,7 @@ export interface FetchOptions extends Omi response?: boolean retry?: number | false - onRequest?(ctx: FetchContext): Promise + onRequest?(ctx: FetchContext): Promise | void onRequestError?(ctx: FetchContext & { error: Error }): Promise onResponse?(ctx: FetchContext & { response: FetchResponse }): Promise onResponseError?(ctx: FetchContext & { response: FetchResponse }): Promise From 3ac4fe9544e0f52259e338096210c8a2aa6bd92f Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Fri, 23 Sep 2022 10:32:04 +0100 Subject: [PATCH 2/2] fix: update other interceptor response types --- src/fetch.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fetch.ts b/src/fetch.ts index 586f6ac..4ddbf7a 100644 --- a/src/fetch.ts +++ b/src/fetch.ts @@ -34,9 +34,9 @@ export interface FetchOptions extends Omi retry?: number | false onRequest?(ctx: FetchContext): Promise | void - onRequestError?(ctx: FetchContext & { error: Error }): Promise - onResponse?(ctx: FetchContext & { response: FetchResponse }): Promise - onResponseError?(ctx: FetchContext & { response: FetchResponse }): Promise + onRequestError?(ctx: FetchContext & { error: Error }): Promise | void + onResponse?(ctx: FetchContext & { response: FetchResponse }): Promise | void + onResponseError?(ctx: FetchContext & { response: FetchResponse }): Promise | void } export interface $Fetch {