From d57e6c346180248c23cf8b53b663ccd858422be1 Mon Sep 17 00:00:00 2001 From: Sorin Muntean Date: Mon, 18 Mar 2024 10:05:39 +0100 Subject: [PATCH] fix `useFetch` type --- docs/utils-reference/getting-started.md | 7 ++++--- src/useFetch.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/utils-reference/getting-started.md b/docs/utils-reference/getting-started.md index 4840da1..1a9ab66 100644 --- a/docs/utils-reference/getting-started.md +++ b/docs/utils-reference/getting-started.md @@ -19,6 +19,7 @@ npm install --save @raycast/utils ### v1.13.3 - Fixed `optimisticUpdate` not working when paginating beyond the first page when using `useCachedPromise` or other hooks that build on top of it.. +- Fixed `useFetch` type requiring `mapResult` for non-paginated overload. ### v1.13.2 @@ -34,12 +35,12 @@ npm install --save @raycast/utils ### v1.12.5 -- Added string array support for OAuth scope (Thanks @tonka3000!). +- Add string array support for OAuth scope (Thanks @tonka3000!). ### v1.12.4 -- Added `tokenResponseParser` and `tokenRefreshResponseParser` in the options of `OAuthService`. -- Fixed built-in Slack OAuthServices. +- Add `tokenResponseParser` and `tokenRefreshResponseParser` in the options of `OAuthService`. +- Fix built-in Slack OAuthServices. ### v1.12.3 diff --git a/src/useFetch.ts b/src/useFetch.ts index cab29d0..fe26fcb 100644 --- a/src/useFetch.ts +++ b/src/useFetch.ts @@ -131,7 +131,7 @@ export function useFetch( url: RequestInfo, options?: RequestInit & { - mapResult: (result: V) => { data: T; hasMore?: boolean }; + mapResult?: (result: V) => { data: T; hasMore?: boolean }; parseResponse?: (response: Response) => Promise; } & Omit Promise, U>, "abortable">, ): UseCachedPromiseReturnType & { pagination: undefined };