-
-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(openapi-react-query): Fix typing of queryOptions (#1952)
- Adds `NoInfer` to function return type because starting from TypeScript 5.5 it can affect inference. For example: const f = <T,>(x: NoInfer<T>) => x; const x: number = f('foo'); ^^^^^ expects number Previous versions could not infer `T` and complained about something like "unknown cannot be assigned to number". This error is not reproducible with `paths` so we test against a minimal paths type. - Excludes `SkipToken` (introduced in v5.25) from `queryFn` to be compatible with `useSuspenseQuery`.
- Loading branch information
1 parent
3988612
commit 455b735
Showing
5 changed files
with
111 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"openapi-react-query": patch | ||
--- | ||
|
||
Fix return type inference for `queryOptions()` when used inside `useQuery` or `useSuspenseQuery`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"openapi-react-query": patch | ||
--- | ||
|
||
Narrow `queryFn` returned by `queryOptions()` to be a function. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters