Skip to content
Source
Sign inSign up
TanStack/query

fix(types): fix promise inference in useQueries #3493

Mergedartysidorenko(GitHub profile, opens in a new tab)merged 2 commits intobeta fromrefs/pull/3493/headmerged by TkDodo View on GitHub

Showing 5 changed files with 4 additions and 3 deletions (loading 2).

x
0 of 5 viewed, 5 left
2 additions and 1 deletionsrc/core/tests/query.test.tsxModified
View file
@@ -803,7 +803,8 @@
​
const observer = new QueryObserver(queryClient, {
queryKey: key,
- queryFn: (() => undefined) as any,
+ // @ts-expect-error (queryFn must not return undefined)
+ queryFn: () => undefined,
retry: false,
​
1 addition and 1 deletionsrc/core/types.tsModified
View file
@@ -14,7 +14,7 @@
TQueryKey extends QueryKey = QueryKey
> = (
context: QueryFunctionContext<TQueryKey>
-) => QueryFunctionData<T> | Promise<QueryFunctionData<T>>
+) => QueryFunctionData<T | Promise<T>>
​
export interface QueryFunctionContext<
TQueryKey extends QueryKey = QueryKey,