react-query-kit 2.0.7-beta.0 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +5 -4
  2. package/build/lib/createInfiniteQuery.esm.js.map +1 -1
  3. package/build/lib/createInfiniteQuery.js.map +1 -1
  4. package/build/lib/createInfiniteQuery.mjs.map +1 -1
  5. package/build/lib/createMutation.esm.js.map +1 -1
  6. package/build/lib/createMutation.js.map +1 -1
  7. package/build/lib/createMutation.mjs.map +1 -1
  8. package/build/lib/createQuery.esm.js.map +1 -1
  9. package/build/lib/createQuery.js.map +1 -1
  10. package/build/lib/createQuery.mjs.map +1 -1
  11. package/build/lib/createSuspenseInfiniteQuery.esm.js +2 -2
  12. package/build/lib/createSuspenseInfiniteQuery.esm.js.map +1 -1
  13. package/build/lib/createSuspenseInfiniteQuery.js +1 -1
  14. package/build/lib/createSuspenseInfiniteQuery.js.map +1 -1
  15. package/build/lib/createSuspenseInfiniteQuery.mjs +2 -2
  16. package/build/lib/createSuspenseInfiniteQuery.mjs.map +1 -1
  17. package/build/lib/createSuspenseQuery.esm.js +2 -2
  18. package/build/lib/createSuspenseQuery.esm.js.map +1 -1
  19. package/build/lib/createSuspenseQuery.js +1 -1
  20. package/build/lib/createSuspenseQuery.js.map +1 -1
  21. package/build/lib/createSuspenseQuery.mjs +2 -2
  22. package/build/lib/createSuspenseQuery.mjs.map +1 -1
  23. package/build/lib/types.d.ts +43 -33
  24. package/build/lib/utils.d.ts +3 -4
  25. package/build/lib/utils.esm.js +5 -6
  26. package/build/lib/utils.esm.js.map +1 -1
  27. package/build/lib/utils.js +4 -5
  28. package/build/lib/utils.js.map +1 -1
  29. package/build/lib/utils.mjs +5 -6
  30. package/build/lib/utils.mjs.map +1 -1
  31. package/build/stats-html.html +1 -1
  32. package/build/stats.json +90 -90
  33. package/build/umd/index.development.js +6 -7
  34. package/build/umd/index.development.js.map +1 -1
  35. package/build/umd/index.production.js +1 -1
  36. package/build/umd/index.production.js.map +1 -1
  37. package/build/zip/zip.esm.js +1 -1
  38. package/package.json +2 -2
  39. package/src/createInfiniteQuery.ts +6 -2
  40. package/src/createMutation.ts +6 -2
  41. package/src/createQuery.tsx +6 -2
  42. package/src/createSuspenseInfiniteQuery.ts +9 -3
  43. package/src/createSuspenseQuery.ts +14 -4
  44. package/src/types.ts +119 -48
  45. package/src/utils.ts +11 -6
@@ -1,12 +1,16 @@
1
1
  import { useInfiniteQuery } from '@tanstack/react-query'
2
2
 
3
3
  import { createBaseQuery } from './createBaseQuery'
4
- import type { CreateInfiniteQueryOptions, InfiniteQueryHook } from './types'
4
+ import type {
5
+ CompatibleError,
6
+ CreateInfiniteQueryOptions,
7
+ InfiniteQueryHook,
8
+ } from './types'
5
9
 
6
10
  export const createInfiniteQuery = <
7
11
  TFnData,
8
12
  TVariables = void,
9
- TError = Error,
13
+ TError = CompatibleError,
10
14
  TPageParam = number
11
15
  >(
12
16
  options: CreateInfiniteQueryOptions<TFnData, TVariables, TError, TPageParam>
@@ -1,12 +1,16 @@
1
1
  import { useMutation } from '@tanstack/react-query'
2
2
 
3
- import type { CreateMutationOptions, MutationHook } from './types'
3
+ import type {
4
+ CompatibleError,
5
+ CreateMutationOptions,
6
+ MutationHook,
7
+ } from './types'
4
8
  import { withMiddleware } from './utils'
5
9
 
6
10
  export const createMutation = <
7
11
  TData = unknown,
8
12
  TVariables = void,
9
- TError = Error,
13
+ TError = CompatibleError,
10
14
  TContext = unknown
11
15
  >(
12
16
  defaultOptions: CreateMutationOptions<TData, TVariables, TError, TContext>
@@ -1,9 +1,13 @@
1
1
  import { useQuery } from '@tanstack/react-query'
2
2
 
3
3
  import { createBaseQuery } from './createBaseQuery'
4
- import type { CreateQueryOptions, QueryHook } from './types'
4
+ import type { CompatibleError, CreateQueryOptions, QueryHook } from './types'
5
5
 
6
- export const createQuery = <TFnData, TVariables = void, TError = Error>(
6
+ export const createQuery = <
7
+ TFnData,
8
+ TVariables = void,
9
+ TError = CompatibleError
10
+ >(
7
11
  options: CreateQueryOptions<TFnData, TVariables, TError>
8
12
  ): QueryHook<TFnData, TVariables, TError> => {
9
13
  return createBaseQuery(options, useQuery)
@@ -1,7 +1,11 @@
1
- import { useInfiniteQuery } from '@tanstack/react-query'
1
+ import {
2
+ useInfiniteQuery,
3
+ useSuspenseInfiniteQuery,
4
+ } from '@tanstack/react-query'
2
5
 
3
6
  import { createBaseQuery } from './createBaseQuery'
4
7
  import type {
8
+ CompatibleError,
5
9
  CreateSuspenseInfiniteQueryOptions,
6
10
  SuspenseInfiniteQueryHook,
7
11
  } from './types'
@@ -10,7 +14,7 @@ import { suspenseOptions } from './utils'
10
14
  export const createSuspenseInfiniteQuery = <
11
15
  TFnData,
12
16
  TVariables = void,
13
- TError = Error,
17
+ TError = CompatibleError,
14
18
  TPageParam = number
15
19
  >(
16
20
  options: CreateSuspenseInfiniteQueryOptions<
@@ -20,5 +24,7 @@ export const createSuspenseInfiniteQuery = <
20
24
  TPageParam
21
25
  >
22
26
  ): SuspenseInfiniteQueryHook<TFnData, TVariables, TError, TPageParam> => {
23
- return createBaseQuery(options, useInfiniteQuery, suspenseOptions)
27
+ return useSuspenseInfiniteQuery
28
+ ? createBaseQuery(options, useSuspenseInfiniteQuery)
29
+ : createBaseQuery(options, useInfiniteQuery, suspenseOptions)
24
30
  }
@@ -1,11 +1,21 @@
1
- import { useQuery } from '@tanstack/react-query'
1
+ import { useQuery, useSuspenseQuery } from '@tanstack/react-query'
2
2
 
3
3
  import { createBaseQuery } from './createBaseQuery'
4
- import type { CreateSuspenseQueryOptions, SuspenseQueryHook } from './types'
4
+ import type {
5
+ CompatibleError,
6
+ CreateSuspenseQueryOptions,
7
+ SuspenseQueryHook,
8
+ } from './types'
5
9
  import { suspenseOptions } from './utils'
6
10
 
7
- export const createSuspenseQuery = <TFnData, TVariables = void, TError = Error>(
11
+ export const createSuspenseQuery = <
12
+ TFnData,
13
+ TVariables = void,
14
+ TError = CompatibleError
15
+ >(
8
16
  options: CreateSuspenseQueryOptions<TFnData, TVariables, TError>
9
17
  ): SuspenseQueryHook<TFnData, TVariables, TError> => {
10
- return createBaseQuery(options, useQuery, suspenseOptions)
18
+ return useSuspenseQuery
19
+ ? createBaseQuery(options, useSuspenseQuery)
20
+ : createBaseQuery(options, useQuery, suspenseOptions)
11
21
  }
package/src/types.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  import type {
2
+ DataTag,
3
+ DefaultError,
4
+ DefinedUseInfiniteQueryResult,
2
5
  DefinedUseQueryResult,
3
6
  GetNextPageParamFunction,
4
7
  GetPreviousPageParamFunction,
@@ -67,7 +70,7 @@ type CompatibleUseInfiniteQueryOptions<
67
70
  TError,
68
71
  TData,
69
72
  TFnData,
70
- inferQueryKey<TVariables>,
73
+ inferQueryKey<TFnData, TVariables, TPageParam>,
71
74
  TPageParam
72
75
  >,
73
76
  UseInfiniteQueryOptions<
@@ -75,7 +78,7 @@ type CompatibleUseInfiniteQueryOptions<
75
78
  TError,
76
79
  TData,
77
80
  TFnData,
78
- inferQueryKey<TVariables>
81
+ inferQueryKey<TFnData, TVariables, TPageParam>
79
82
  >
80
83
  >
81
84
 
@@ -90,15 +93,31 @@ type WithRequired<T, K extends keyof T> = T & {
90
93
  [_ in K]: {}
91
94
  }
92
95
 
93
- export type inferQueryKey<TVariables> = TVariables extends void
96
+ export type CompatibleError = CompatibleWithV4<DefaultError, Error>
97
+
98
+ type GetQueryKey<TVariables> = TVariables extends void
94
99
  ? [string]
95
100
  : [string, TVariables]
96
101
 
102
+ export type inferQueryKey<
103
+ TFnData,
104
+ TVariables,
105
+ TPageParam = never
106
+ > = CompatibleWithV4<
107
+ DataTag<
108
+ GetQueryKey<TVariables>,
109
+ [TPageParam] extends [never]
110
+ ? TFnData
111
+ : CompatibleInfiniteData<TFnData, TPageParam>
112
+ >,
113
+ GetQueryKey<TVariables>
114
+ >
115
+
97
116
  export type AdditionalQueryOptions<TFnData, TVariables, TPageParam = never> = {
98
117
  primaryKey: string
99
118
  queryFn: CompatibleQueryFunction<
100
119
  TFnData,
101
- inferQueryKey<TVariables>,
120
+ inferQueryKey<TFnData, TVariables, TPageParam>,
102
121
  TPageParam
103
122
  >
104
123
  variables?: TVariables
@@ -119,41 +138,79 @@ type DeepPartial<T> = T extends object
119
138
  }
120
139
  : T
121
140
 
122
- export type ExposeMethods<TFnData, TVariables, TPageParam = never> = {
141
+ export type ExposeMethods<TFnData, TVariables, TError, TPageParam = never> = {
123
142
  getPrimaryKey: () => string
124
143
  getKey: <V extends DeepPartial<TVariables> | void = void>(
125
144
  variables?: V
126
- ) => inferQueryKey<V>
145
+ ) => inferQueryKey<TFnData, V, TPageParam>
127
146
  queryFn: CompatibleQueryFunction<
128
147
  TFnData,
129
- inferQueryKey<TVariables>,
148
+ inferQueryKey<TFnData, TVariables, TPageParam>,
130
149
  TPageParam
131
150
  >
132
- queryKeyHashFn: QueryKeyHashFunction<inferQueryKey<TVariables>>
151
+ queryKeyHashFn: QueryKeyHashFunction<
152
+ inferQueryKey<TFnData, TVariables, TPageParam>
153
+ >
133
154
  getFetchOptions: (
134
155
  variables: TVariables extends void ? TVariables | void : TVariables
135
156
  ) => [TPageParam] extends [never]
136
157
  ? {
137
- queryKey: inferQueryKey<TVariables>
158
+ queryKey: inferQueryKey<TFnData, TVariables, TPageParam>
138
159
  queryFn: CompatibleQueryFunction<
139
160
  TFnData,
140
- inferQueryKey<TVariables>,
161
+ inferQueryKey<TFnData, TVariables, TPageParam>,
141
162
  TPageParam
142
163
  >
143
- queryKeyHashFn?: QueryKeyHashFunction<inferQueryKey<TVariables>>
164
+ queryKeyHashFn?: QueryKeyHashFunction<
165
+ inferQueryKey<TFnData, TVariables, TPageParam>
166
+ >
144
167
  }
145
168
  : {
146
- queryKey: inferQueryKey<TVariables>
169
+ queryKey: inferQueryKey<TFnData, TVariables, TPageParam>
147
170
  queryFn: CompatibleQueryFunction<
148
171
  TFnData,
149
- inferQueryKey<TVariables>,
172
+ inferQueryKey<TFnData, TVariables, TPageParam>,
150
173
  TPageParam
151
174
  >
152
- queryKeyHashFn?: QueryKeyHashFunction<inferQueryKey<TVariables>>
175
+ queryKeyHashFn?: QueryKeyHashFunction<
176
+ inferQueryKey<TFnData, TVariables, TPageParam>
177
+ >
153
178
  } & CompatibleInfiniteQueryPageParamsOptions<TFnData, TPageParam>
154
- // TODO This seems pretty hacky for select & useQueries.
155
- // But not work to infer TError, Hope to fix it.
156
- getOptions: ExposeMethods<TFnData, TVariables, TPageParam>['getFetchOptions']
179
+ getOptions: (
180
+ variables: TVariables extends void ? TVariables | void : TVariables
181
+ ) => [TPageParam] extends [never]
182
+ ? CompatibleWithV4<
183
+ UseQueryOptions<
184
+ TFnData,
185
+ TError,
186
+ TFnData,
187
+ inferQueryKey<
188
+ TVariables,
189
+ [TPageParam] extends [never]
190
+ ? TFnData
191
+ : CompatibleInfiniteData<TFnData, TPageParam>
192
+ >
193
+ >,
194
+ // Not work to infer TError in v4
195
+ {
196
+ queryKey: inferQueryKey<TFnData, TVariables, TPageParam>
197
+ queryFn: CompatibleQueryFunction<
198
+ TFnData,
199
+ inferQueryKey<TFnData, TVariables, TPageParam>,
200
+ TPageParam
201
+ >
202
+ queryKeyHashFn?: QueryKeyHashFunction<
203
+ inferQueryKey<TFnData, TVariables, TPageParam>
204
+ >
205
+ }
206
+ >
207
+ : CompatibleUseInfiniteQueryOptions<
208
+ TFnData,
209
+ TVariables,
210
+ TFnData,
211
+ TError,
212
+ TPageParam
213
+ >
157
214
  }
158
215
 
159
216
  // query hook
@@ -161,9 +218,14 @@ export type ExposeMethods<TFnData, TVariables, TPageParam = never> = {
161
218
  export interface CreateQueryOptions<
162
219
  TFnData = unknown,
163
220
  TVariables = void,
164
- TError = Error
221
+ TError = CompatibleError
165
222
  > extends Omit<
166
- UseQueryOptions<TFnData, TError, TFnData, inferQueryKey<TVariables>>,
223
+ UseQueryOptions<
224
+ TFnData,
225
+ TError,
226
+ TFnData,
227
+ inferQueryKey<TFnData, TVariables>
228
+ >,
167
229
  'queryKey' | 'queryFn' | 'select'
168
230
  >,
169
231
  AdditionalQueryOptions<TFnData, TVariables> {
@@ -173,17 +235,18 @@ export interface CreateQueryOptions<
173
235
 
174
236
  export interface QueryHookOptions<TFnData, TError, TData, TVariables>
175
237
  extends Omit<
176
- UseQueryOptions<TFnData, TError, TData, inferQueryKey<TVariables>>,
238
+ UseQueryOptions<TFnData, TError, TData, inferQueryKey<TFnData, TVariables>>,
177
239
  'queryKey' | 'queryFn' | 'queryKeyHashFn'
178
240
  > {
179
241
  use?: Middleware<QueryHook<TFnData, TVariables, TError>>[]
180
242
  variables?: TVariables
181
243
  }
182
244
 
183
- export type DefinedQueryHookOptions<TFnData, TError, TData, TVariables> = Omit<
184
- QueryHookOptions<TFnData, TError, TData, TVariables>,
185
- 'initialData'
186
- > & {
245
+ export interface DefinedQueryHookOptions<TFnData, TError, TData, TVariables>
246
+ extends Omit<
247
+ QueryHookOptions<TFnData, TError, TData, TVariables>,
248
+ 'initialData'
249
+ > {
187
250
  initialData: NonUndefinedGuard<TFnData> | (() => NonUndefinedGuard<TFnData>)
188
251
  }
189
252
 
@@ -194,8 +257,11 @@ export type DefinedQueryHookResult<TData, TError> = DefinedUseQueryResult<
194
257
  TError
195
258
  >
196
259
 
197
- export interface QueryHook<TFnData = unknown, TVariables = any, TError = Error>
198
- extends ExposeMethods<TFnData, TVariables> {
260
+ export interface QueryHook<
261
+ TFnData = unknown,
262
+ TVariables = any,
263
+ TError = CompatibleError
264
+ > extends ExposeMethods<TFnData, TVariables, TError> {
199
265
  <TData = TFnData>(
200
266
  options: DefinedQueryHookOptions<TFnData, TError, TData, TVariables>,
201
267
  queryClient?: CompatibleWithV4<QueryClient, void>
@@ -211,9 +277,14 @@ export interface QueryHook<TFnData = unknown, TVariables = any, TError = Error>
211
277
  export interface CreateSuspenseQueryOptions<
212
278
  TFnData = unknown,
213
279
  TVariables = void,
214
- TError = Error
280
+ TError = CompatibleError
215
281
  > extends Omit<
216
- UseQueryOptions<TFnData, TError, TFnData, inferQueryKey<TVariables>>,
282
+ UseQueryOptions<
283
+ TFnData,
284
+ TError,
285
+ TFnData,
286
+ inferQueryKey<TFnData, TVariables>
287
+ >,
217
288
  | 'queryKey'
218
289
  | 'queryFn'
219
290
  | 'enabled'
@@ -230,7 +301,7 @@ export interface CreateSuspenseQueryOptions<
230
301
 
231
302
  export interface SuspenseQueryHookOptions<TFnData, TError, TData, TVariables>
232
303
  extends Omit<
233
- UseQueryOptions<TFnData, TError, TData, inferQueryKey<TVariables>>,
304
+ UseQueryOptions<TFnData, TError, TData, inferQueryKey<TFnData, TVariables>>,
234
305
  | 'queryKey'
235
306
  | 'queryFn'
236
307
  | 'queryKeyHashFn'
@@ -253,8 +324,8 @@ export type SuspenseQueryHookResult<TData, TError> = Omit<
253
324
  export interface SuspenseQueryHook<
254
325
  TFnData = unknown,
255
326
  TVariables = void,
256
- TError = Error
257
- > extends ExposeMethods<TFnData, TVariables> {
327
+ TError = CompatibleError
328
+ > extends ExposeMethods<TFnData, TVariables, TError> {
258
329
  <TData = TFnData>(
259
330
  options?: SuspenseQueryHookOptions<TFnData, TError, TData, TVariables>,
260
331
  queryClient?: CompatibleWithV4<QueryClient, void>
@@ -266,7 +337,7 @@ export interface SuspenseQueryHook<
266
337
  export interface CreateInfiniteQueryOptions<
267
338
  TFnData = unknown,
268
339
  TVariables = void,
269
- TError = Error,
340
+ TError = CompatibleError,
270
341
  TPageParam = number
271
342
  > extends Omit<
272
343
  CompatibleUseInfiniteQueryOptions<
@@ -307,18 +378,18 @@ export interface InfiniteQueryHookOptions<
307
378
  variables?: TVariables
308
379
  }
309
380
 
310
- export type DefinedInfiniteQueryHookOptions<
381
+ export interface DefinedInfiniteQueryHookOptions<
311
382
  TFnData,
312
383
  TError,
313
384
  TData,
314
385
  TVariables,
315
386
  TPageParam = number
316
- > = Omit<
317
- InfiniteQueryHookOptions<TFnData, TError, TData, TVariables, TPageParam>,
318
- 'initialData'
319
- > & {
387
+ > extends Omit<
388
+ InfiniteQueryHookOptions<TFnData, TError, TData, TVariables, TPageParam>,
389
+ 'initialData'
390
+ > {
320
391
  initialData:
321
- | CompatibleInfiniteData<TFnData, TPageParam>
392
+ | NonUndefinedGuard<CompatibleInfiniteData<TFnData, TPageParam>>
322
393
  | (() => NonUndefinedGuard<CompatibleInfiniteData<TFnData, TPageParam>>)
323
394
  }
324
395
 
@@ -327,17 +398,17 @@ export type InfiniteQueryHookResult<TData, TError> = UseInfiniteQueryResult<
327
398
  TError
328
399
  >
329
400
 
330
- export type DefinedInfiniteQueryHookResult<TData, TError> = WithRequired<
331
- UseInfiniteQueryResult<TData, TError>,
332
- 'data'
401
+ export type DefinedInfiniteQueryHookResult<TData, TError> = CompatibleWithV4<
402
+ DefinedUseInfiniteQueryResult<TData, TError>,
403
+ WithRequired<UseInfiniteQueryResult<TData, TError>, 'data'>
333
404
  >
334
405
 
335
406
  export interface InfiniteQueryHook<
336
407
  TFnData = unknown,
337
408
  TVariables = void,
338
- TError = Error,
409
+ TError = CompatibleError,
339
410
  TPageParam = number
340
- > extends ExposeMethods<TFnData, TVariables, TPageParam> {
411
+ > extends ExposeMethods<TFnData, TVariables, TError, TPageParam> {
341
412
  <TData = CompatibleWithV4<InfiniteData<TFnData, TPageParam>, TFnData>>(
342
413
  options: DefinedInfiniteQueryHookOptions<
343
414
  TFnData,
@@ -365,7 +436,7 @@ export interface InfiniteQueryHook<
365
436
  export interface CreateSuspenseInfiniteQueryOptions<
366
437
  TFnData = unknown,
367
438
  TVariables = void,
368
- TError = Error,
439
+ TError = CompatibleError,
369
440
  TPageParam = number
370
441
  > extends Omit<
371
442
  CompatibleUseInfiniteQueryOptions<
@@ -428,9 +499,9 @@ export type SuspenseInfiniteQueryHookResult<TData, TError> = Omit<
428
499
  export interface SuspenseInfiniteQueryHook<
429
500
  TFnData = unknown,
430
501
  TVariables = void,
431
- TError = Error,
502
+ TError = CompatibleError,
432
503
  TPageParam = number
433
- > extends ExposeMethods<TFnData, TVariables, TPageParam> {
504
+ > extends ExposeMethods<TFnData, TVariables, TError, TPageParam> {
434
505
  <TData = CompatibleWithV4<InfiniteData<TFnData, TPageParam>, TFnData>>(
435
506
  options?: SuspenseInfiniteQueryHookOptions<
436
507
  TFnData,
@@ -448,7 +519,7 @@ export interface SuspenseInfiniteQueryHook<
448
519
  export interface CreateMutationOptions<
449
520
  TData = unknown,
450
521
  TVariables = void,
451
- TError = Error,
522
+ TError = CompatibleError,
452
523
  TContext = unknown
453
524
  > extends UseMutationOptions<TData, TError, TVariables, TContext> {
454
525
  use?: Middleware<MutationHook<TData, TError, TVariables>>[]
@@ -465,7 +536,7 @@ export interface MutationHookOptions<TData, TError, TVariables, TContext>
465
536
 
466
537
  export type MutationHookResult<
467
538
  TData = unknown,
468
- TError = Error,
539
+ TError = CompatibleError,
469
540
  TVariables = void,
470
541
  TContext = unknown
471
542
  > = UseMutationResult<TData, TError, TVariables, TContext>
package/src/utils.ts CHANGED
@@ -1,4 +1,9 @@
1
- import { type QueryClient, useQueryClient } from '@tanstack/react-query'
1
+ import {
2
+ type Query,
3
+ type QueryClient,
4
+ useQueryClient,
5
+ useSuspenseQuery,
6
+ } from '@tanstack/react-query'
2
7
 
3
8
  import type { Middleware, inferQueryKey } from './types'
4
9
 
@@ -14,7 +19,7 @@ export const withMiddleware = (
14
19
  const [middleware, opts] = [
15
20
  useQueryClient(
16
21
  // @ts-ignore Compatible with ReactQuery v4
17
- options?.context ? options : queryClient
22
+ useSuspenseQuery ? queryClient : options
18
23
  ).getDefaultOptions()[type],
19
24
  defaultOptions,
20
25
  options,
@@ -35,12 +40,12 @@ export const withMiddleware = (
35
40
  }
36
41
  }
37
42
 
43
+ // Compatible with ReactQuery v4
38
44
  export const suspenseOptions = {
39
45
  enabled: true,
40
46
  suspense: true,
41
- throwOnError: true,
42
- // Compatible with ReactQuery v4
43
- useErrorBoundary: true,
47
+ useErrorBoundary: (_error: unknown, query: Query) =>
48
+ query.state.data === undefined,
44
49
  }
45
50
 
46
51
  export const getKey = <TVariables = void>(
@@ -49,5 +54,5 @@ export const getKey = <TVariables = void>(
49
54
  ) => {
50
55
  return (
51
56
  variables === undefined ? [primaryKey] : [primaryKey, variables]
52
- ) as inferQueryKey<TVariables>
57
+ ) as inferQueryKey<unknown, TVariables>
53
58
  }