@trpc/react-query 11.23.1-canary.3.ae3beada3 → 11.23.1-canary.30.70e1d688c

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 (53) hide show
  1. package/dist/{getQueryKey-BqoKYDMR.d.cts → getQueryKey-B3wY6Hsc.d.mts} +278 -23
  2. package/dist/getQueryKey-B3wY6Hsc.d.mts.map +1 -0
  3. package/dist/{getQueryKey-D3tJ34z0.mjs → getQueryKey-CWSorJjT.mjs} +25 -9
  4. package/dist/getQueryKey-CWSorJjT.mjs.map +1 -0
  5. package/dist/{getQueryKey-CMt5tN9-.d.mts → getQueryKey-CkLbRjaS.d.cts} +278 -23
  6. package/dist/getQueryKey-CkLbRjaS.d.cts.map +1 -0
  7. package/dist/{getQueryKey-Db_3VDGo.cjs → getQueryKey-DASF3nl1.cjs} +24 -8
  8. package/dist/index.cjs +24 -2
  9. package/dist/index.d.cts +10 -1
  10. package/dist/index.d.cts.map +1 -1
  11. package/dist/index.d.mts +10 -1
  12. package/dist/index.d.mts.map +1 -1
  13. package/dist/index.mjs +24 -2
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/rsc.cjs +11 -3
  16. package/dist/rsc.d.cts +11 -3
  17. package/dist/rsc.d.cts.map +1 -1
  18. package/dist/rsc.d.mts +11 -3
  19. package/dist/rsc.d.mts.map +1 -1
  20. package/dist/rsc.mjs +11 -3
  21. package/dist/rsc.mjs.map +1 -1
  22. package/dist/server/index.cjs +30 -11
  23. package/dist/server/index.d.cts +17 -3
  24. package/dist/server/index.d.cts.map +1 -1
  25. package/dist/server/index.d.mts +17 -3
  26. package/dist/server/index.d.mts.map +1 -1
  27. package/dist/server/index.mjs +30 -11
  28. package/dist/server/index.mjs.map +1 -1
  29. package/dist/shared/index.cjs +1 -1
  30. package/dist/shared/index.d.cts +1 -1
  31. package/dist/shared/index.d.mts +1 -1
  32. package/dist/shared/index.mjs +1 -1
  33. package/dist/{shared-Bw5jcbcM.mjs → shared-DyU-Vz6d.mjs} +11 -2
  34. package/dist/shared-DyU-Vz6d.mjs.map +1 -0
  35. package/dist/{shared-ByAY3gMr.cjs → shared-v3jJm-s7.cjs} +10 -1
  36. package/package.json +6 -6
  37. package/src/createTRPCQueryUtils.tsx +9 -0
  38. package/src/createTRPCReact.tsx +40 -7
  39. package/src/internals/context.tsx +21 -0
  40. package/src/internals/getQueryKey.ts +24 -8
  41. package/src/internals/useQueries.ts +77 -29
  42. package/src/rsc.tsx +10 -2
  43. package/src/server/ssgProxy.ts +41 -5
  44. package/src/shared/hooks/createHooksInternal.tsx +28 -2
  45. package/src/shared/hooks/types.ts +93 -0
  46. package/src/shared/polymorphism/routerLike.ts +3 -0
  47. package/src/shared/proxy/utilsProxy.ts +15 -0
  48. package/src/shared/types.ts +50 -2
  49. package/src/utils/inferReactQueryProcedure.ts +8 -0
  50. package/dist/getQueryKey-BqoKYDMR.d.cts.map +0 -1
  51. package/dist/getQueryKey-CMt5tN9-.d.mts.map +0 -1
  52. package/dist/getQueryKey-D3tJ34z0.mjs.map +0 -1
  53. package/dist/shared-Bw5jcbcM.mjs.map +0 -1
@@ -297,7 +297,7 @@ export type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> =
297
297
  TDef['input'] extends CursorInput
298
298
  ? {
299
299
  /**
300
- * @see https://trpc.io/docs/v11/client/react/useInfiniteQuery
300
+ * @see https://trpc.io/docs/client/react/useInfiniteQuery
301
301
  */
302
302
  useInfiniteQuery: useTRPCInfiniteQuery<TDef>;
303
303
  /**
@@ -321,12 +321,12 @@ export type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> =
321
321
  */
322
322
  export type DecoratedQueryMethods<TDef extends ResolverDef> = {
323
323
  /**
324
- * @see https://trpc.io/docs/v11/client/react/useQuery
324
+ * @see https://trpc.io/docs/client/react/useQuery
325
325
  */
326
326
  useQuery: ProcedureUseQuery<TDef>;
327
327
  usePrefetchQuery: ProcedureUsePrefetchQuery<TDef>;
328
328
  /**
329
- * @see https://trpc.io/docs/v11/client/react/suspense#usesuspensequery
329
+ * @see https://trpc.io/docs/client/react/suspense#usesuspensequery
330
330
  */
331
331
  useSuspenseQuery: <
332
332
  TQueryFnData extends TDef['output'] = TDef['output'],
@@ -352,7 +352,7 @@ export type DecoratedQuery<TDef extends ResolverDef> =
352
352
 
353
353
  export type DecoratedMutation<TDef extends ResolverDef> = {
354
354
  /**
355
- * @see https://trpc.io/docs/v11/client/react/useMutation
355
+ * @see https://trpc.io/docs/client/react/useMutation
356
356
  */
357
357
  useMutation: <TContext = unknown>(
358
358
  opts?: UseTRPCMutationOptions<
@@ -410,7 +410,7 @@ export type DecorateProcedure<
410
410
  : TType extends 'subscription'
411
411
  ? {
412
412
  /**
413
- * @see https://trpc.io/docs/v11/subscriptions
413
+ * @see https://trpc.io/docs/client/react/useSubscription
414
414
  */
415
415
  useSubscription: ProcedureUseSubscription<TDef>;
416
416
  }
@@ -447,19 +447,39 @@ export type CreateTRPCReactBase<TRouter extends AnyRouter, TSSRContext> = {
447
447
  /**
448
448
  * @deprecated renamed to `useUtils` and will be removed in a future tRPC version
449
449
  *
450
- * @see https://trpc.io/docs/v11/client/react/useUtils
450
+ * @see https://trpc.io/docs/client/react/useUtils
451
451
  */
452
452
  useContext(): CreateReactUtils<TRouter, TSSRContext>;
453
453
  /**
454
- * @see https://trpc.io/docs/v11/client/react/useUtils
454
+ * @see https://trpc.io/docs/client/react/useUtils
455
455
  */
456
456
  useUtils(): CreateReactUtils<TRouter, TSSRContext>;
457
+ /**
458
+ * Provides the tRPC client and `QueryClient` to the hooks.
459
+ * @see https://trpc.io/docs/client/react/setup#4-add-trpc-providers
460
+ */
457
461
  Provider: TRPCProvider<TRouter, TSSRContext>;
462
+ /**
463
+ * Same as `createTRPCClient`, typed for this router.
464
+ */
458
465
  createClient: typeof createTRPCClient<TRouter>;
466
+ /**
467
+ * @see https://trpc.io/docs/client/react/useQueries
468
+ */
459
469
  useQueries: TRPCUseQueries<TRouter>;
470
+ /**
471
+ * @see https://trpc.io/docs/client/react/suspense#usesuspensequeries
472
+ */
460
473
  useSuspenseQueries: TRPCUseSuspenseQueries<TRouter>;
461
474
  };
462
475
 
476
+ /**
477
+ * The hooks object returned by {@link createTRPCReact}.
478
+ *
479
+ * @deprecated `@trpc/react-query` only gets bug fixes and will be removed in
480
+ * the next major version. Use `@trpc/tanstack-react-query` instead.
481
+ * @see https://trpc.io/docs/client/tanstack-react-query/migrating
482
+ */
463
483
  export type CreateTRPCReact<
464
484
  TRouter extends AnyRouter,
465
485
  TSSRContext,
@@ -505,6 +525,19 @@ export function createHooksInternal<
505
525
  });
506
526
  }
507
527
 
528
+ /**
529
+ * Creates typed React hooks for your router, built on TanStack React Query.
530
+ *
531
+ * @example
532
+ * ```ts
533
+ * export const trpc = createTRPCReact<AppRouter>();
534
+ * ```
535
+ *
536
+ * @deprecated `@trpc/react-query` only gets bug fixes and will be removed in
537
+ * the next major version. Use `@trpc/tanstack-react-query` instead.
538
+ * @see https://trpc.io/docs/client/tanstack-react-query/migrating
539
+ * @see https://trpc.io/docs/client/react/setup
540
+ */
508
541
  export function createTRPCReact<
509
542
  TRouter extends AnyRouter,
510
543
  TSSRContext = unknown,
@@ -46,6 +46,9 @@ interface TRPCUseUtilsOptions {
46
46
  */
47
47
  trpc?: TRPCRequestOptions;
48
48
  }
49
+ /**
50
+ * Options for the `fetch` and `prefetch` helpers.
51
+ */
49
52
  export interface TRPCFetchQueryOptions<TOutput, TError>
50
53
  extends
51
54
  DistributiveOmit<FetchQueryOptions<TOutput, TError>, 'queryKey'>,
@@ -53,6 +56,9 @@ export interface TRPCFetchQueryOptions<TOutput, TError>
53
56
  //
54
57
  }
55
58
 
59
+ /**
60
+ * Options for the `fetchInfinite` and `prefetchInfinite` helpers.
61
+ */
56
62
  export type TRPCFetchInfiniteQueryOptions<TInput, TOutput, TError> =
57
63
  DistributiveOmit<
58
64
  FetchInfiniteQueryOptions<
@@ -65,12 +71,18 @@ export type TRPCFetchInfiniteQueryOptions<TInput, TOutput, TError> =
65
71
  'queryKey' | 'initialPageParam'
66
72
  > &
67
73
  TRPCUseUtilsOptions & {
74
+ /**
75
+ * The cursor for the first page.
76
+ */
68
77
  initialCursor?: ExtractCursorType<TInput>;
69
78
  };
70
79
 
71
80
  /** @internal */
72
81
  export type SSRState = 'mounted' | 'mounting' | 'prepass' | false;
73
82
 
83
+ /**
84
+ * Props shared by the tRPC React context and its `Provider`.
85
+ */
74
86
  export interface TRPCContextPropsBase<TRouter extends AnyRouter, TSSRContext> {
75
87
  /**
76
88
  * The `TRPCClient`
@@ -108,6 +120,9 @@ export type DecoratedTRPCContextProps<
108
120
  client: TRPCClient<TRouter>;
109
121
  };
110
122
 
123
+ /**
124
+ * Props for the tRPC React context: the base props plus a `QueryClient`.
125
+ */
111
126
  export interface TRPCContextProps<
112
127
  TRouter extends AnyRouter,
113
128
  TSSRContext,
@@ -118,6 +133,9 @@ export interface TRPCContextProps<
118
133
  queryClient: QueryClient;
119
134
  }
120
135
 
136
+ /**
137
+ * The keys of {@link TRPCContextPropsBase}.
138
+ */
121
139
  export const contextProps: (keyof TRPCContextPropsBase<any, any>)[] = [
122
140
  'client',
123
141
  'ssrContext',
@@ -353,4 +371,7 @@ export interface TRPCQueryUtils<TRouter extends AnyRouter> {
353
371
  */
354
372
  isMutating: (filters: { mutationKey: TRPCMutationKey }) => number;
355
373
  }
374
+ /**
375
+ * The React context that holds the tRPC client and `QueryClient`.
376
+ */
356
377
  export const TRPCContext = React.createContext?.(null as any);
@@ -100,11 +100,22 @@ type GetParams<TProcedureOrRouter extends ProcedureOrRouter> =
100
100
  : [];
101
101
 
102
102
  /**
103
- * Method to extract the query key for a procedure
104
- * @param procedureOrRouter - procedure or AnyRouter
105
- * @param input - input to procedureOrRouter
106
- * @param type - defaults to `any`
107
- * @see https://trpc.io/docs/v11/getQueryKey
103
+ * Returns the TanStack Query key for a procedure or router.
104
+ * @param procedureOrRouter - a procedure or router from `createTRPCReact`
105
+ * @param input - the procedure input. Leave it out to match every input in
106
+ * fuzzy operations like `invalidateQueries`.
107
+ * @param type - `'query'`, `'infinite'` or `'any'` (default). `'any'` leaves
108
+ * the type out of the key, so exact reads like `getQueryData` need the same
109
+ * input the query used and the matching type. Infinite query keys leave out
110
+ * `cursor` and `direction`.
111
+ *
112
+ * @deprecated `@trpc/react-query` only gets bug fixes and will be removed in
113
+ * the next major version. Use `@trpc/tanstack-react-query` instead, where
114
+ * each query procedure has a `queryKey()` method and each router has a
115
+ * `pathKey()` method.
116
+ * @see https://trpc.io/docs/client/tanstack-react-query/migrating
117
+ * @see https://trpc.io/docs/client/tanstack-react-query/usage#queryKey
118
+ * @see https://trpc.io/docs/client/react/getQueryKey
108
119
  */
109
120
  export function getQueryKey<TProcedureOrRouter extends ProcedureOrRouter>(
110
121
  procedureOrRouter: TProcedureOrRouter,
@@ -125,9 +136,14 @@ export type QueryKeyKnown<TInput, TType extends Exclude<QueryType, 'any'>> = [
125
136
  ];
126
137
 
127
138
  /**
128
- * Method to extract the mutation key for a procedure
129
- * @param procedure - procedure
130
- * @see https://trpc.io/docs/v11/getQueryKey#mutations
139
+ * Returns the TanStack Query mutation key for a procedure.
140
+ *
141
+ * @deprecated `@trpc/react-query` only gets bug fixes and will be removed in
142
+ * the next major version. Use `@trpc/tanstack-react-query` instead, where
143
+ * each mutation has a `mutationKey()` method.
144
+ * @see https://trpc.io/docs/client/tanstack-react-query/migrating
145
+ * @see https://trpc.io/docs/client/tanstack-react-query/usage#mutationKey
146
+ * @see https://trpc.io/docs/client/react/getQueryKey#mutations
131
147
  */
132
148
  export function getMutationKey<TProcedure extends DecoratedMutation<any>>(
133
149
  procedure: TProcedure,
@@ -186,36 +186,84 @@ export type SuspenseQueriesOptions<
186
186
  /**
187
187
  * @internal
188
188
  */
189
- export type TRPCUseQueries<TRouter extends AnyRouter> = <
190
- TQueryOptions extends UseQueryOptionsForUseQueries<any, any, any, any>[],
191
- TCombinedResult = QueriesResults<TQueryOptions>,
192
- >(
193
- queriesCallback: (
194
- t: UseQueriesProcedureRecord<
195
- TRouter['_def']['_config']['$types'],
196
- TRouter['_def']['record']
197
- >,
198
- ) => readonly [...QueriesOptions<TQueryOptions>],
199
- options?: {
200
- combine?: (results: QueriesResults<TQueryOptions>) => TCombinedResult;
201
- },
202
- ) => TCombinedResult;
189
+ export type TRPCUseQueries<TRouter extends AnyRouter> = {
190
+ <
191
+ TQueryOptions extends UseQueryOptionsForUseQueries<any, any, any, any>[],
192
+ TCombinedResult = QueriesResults<TQueryOptions>,
193
+ >(
194
+ queriesCallback: (
195
+ t: UseQueriesProcedureRecord<
196
+ TRouter['_def']['_config']['$types'],
197
+ TRouter['_def']['record']
198
+ >,
199
+ ) => readonly [...QueriesOptions<TQueryOptions>],
200
+ options?: {
201
+ combine?: (results: QueriesResults<TQueryOptions>) => TCombinedResult;
202
+ },
203
+ ): TCombinedResult;
204
+ /**
205
+ * `TQueryOptions` cannot be inferred from the tuple spread above when the
206
+ * callback returns a union of tuples - e.g. conditionally returning `[]` -
207
+ * so those callbacks are matched by this overload instead, which infers the
208
+ * options array directly.
209
+ */
210
+ <
211
+ TQueries extends readonly UseQueryOptionsForUseQueries<
212
+ any,
213
+ any,
214
+ any,
215
+ any
216
+ >[],
217
+ TCombinedResult = QueriesResults<[...TQueries]>,
218
+ >(
219
+ queriesCallback: (
220
+ t: UseQueriesProcedureRecord<
221
+ TRouter['_def']['_config']['$types'],
222
+ TRouter['_def']['record']
223
+ >,
224
+ ) => TQueries,
225
+ options?: {
226
+ combine?: (results: QueriesResults<[...TQueries]>) => TCombinedResult;
227
+ },
228
+ ): TCombinedResult;
229
+ };
203
230
 
204
231
  /**
205
232
  * @internal
206
233
  */
207
- export type TRPCUseSuspenseQueries<TRouter extends AnyRouter> = <
208
- TQueryOptions extends UseQueryOptionsForUseSuspenseQueries<
209
- any,
210
- any,
211
- any,
212
- any
213
- >[],
214
- >(
215
- queriesCallback: (
216
- t: UseSuspenseQueriesProcedureRecord<
217
- TRouter['_def']['_config']['$types'],
218
- TRouter['_def']['record']
219
- >,
220
- ) => readonly [...SuspenseQueriesOptions<TQueryOptions>],
221
- ) => SuspenseQueriesResults<TQueryOptions>;
234
+ export type TRPCUseSuspenseQueries<TRouter extends AnyRouter> = {
235
+ <
236
+ TQueryOptions extends UseQueryOptionsForUseSuspenseQueries<
237
+ any,
238
+ any,
239
+ any,
240
+ any
241
+ >[],
242
+ >(
243
+ queriesCallback: (
244
+ t: UseSuspenseQueriesProcedureRecord<
245
+ TRouter['_def']['_config']['$types'],
246
+ TRouter['_def']['record']
247
+ >,
248
+ ) => readonly [...SuspenseQueriesOptions<TQueryOptions>],
249
+ ): SuspenseQueriesResults<TQueryOptions>;
250
+ /**
251
+ * Same as the `TRPCUseQueries` fallback: matches callbacks that return a
252
+ * union of tuples, which can't be inferred through the tuple spread above.
253
+ */
254
+ <
255
+ TQueries extends readonly UseQueryOptionsForUseSuspenseQueries<
256
+ any,
257
+ any,
258
+ any,
259
+ any
260
+ >[],
261
+ >(
262
+ queriesCallback: (
263
+ t: UseSuspenseQueriesProcedureRecord<
264
+ TRouter['_def']['_config']['$types'],
265
+ TRouter['_def']['record']
266
+ >,
267
+ ) => TQueries,
268
+ ): SuspenseQueriesResults<[...TQueries]>;
269
+ };
package/src/rsc.tsx CHANGED
@@ -74,6 +74,9 @@ type Caller<TRouter extends AnyRouter> = ReturnType<
74
74
 
75
75
  // ts-prune-ignore-next
76
76
  /**
77
+ * Creates a server-side caller that can also prefetch queries, plus a
78
+ * `HydrateClient` component that sends the prefetched data to the client.
79
+ *
77
80
  * @note This requires `@tanstack/react-query@^5.49.0`
78
81
  * @note Make sure to have `dehydrate.serializeData` and `hydrate.deserializeData`
79
82
  * set to your data transformer in your `QueryClient` factory.
@@ -91,6 +94,11 @@ type Caller<TRouter extends AnyRouter> = ReturnType<
91
94
  * },
92
95
  * });
93
96
  * ```
97
+ *
98
+ * @deprecated `@trpc/react-query` only gets bug fixes and will be removed in
99
+ * the next major version. Use `@trpc/tanstack-react-query` instead.
100
+ * @see https://trpc.io/docs/client/tanstack-react-query/migrating
101
+ * @see https://trpc.io/docs/client/react/server-components
94
102
  */
95
103
  export function createHydrationHelpers<TRouter extends AnyRouter>(
96
104
  caller: AnyRouter extends TRouter
@@ -174,8 +182,8 @@ export function createHydrationHelpers<TRouter extends AnyRouter>(
174
182
  * @example
175
183
  * ```tsx
176
184
  * // MyRSC.tsx
177
- * const MyRSC = ({ params }) => {
178
- * void trpc.post.get.prefetch(params.postId);
185
+ * const MyRSC = async ({ params }) => {
186
+ * await trpc.post.get.prefetch(params.postId);
179
187
  *
180
188
  * return (
181
189
  * <HydrateClient>
@@ -2,6 +2,7 @@ import type {
2
2
  DehydratedState,
3
3
  DehydrateOptions,
4
4
  QueryClient,
5
+ QueryFunctionContext,
5
6
  } from '@tanstack/react-query';
6
7
  import { dehydrate } from '@tanstack/react-query';
7
8
  import type { TRPCClient } from '@trpc/client';
@@ -27,6 +28,8 @@ import {
27
28
  createRecursiveProxy,
28
29
  run,
29
30
  } from '@trpc/server/unstable-core-do-not-import';
31
+ import { getClientArgs } from '../internals/getClientArgs';
32
+ import type { TRPCQueryKey } from '../internals/getQueryKey';
30
33
  import { getQueryKeyInternal } from '../internals/getQueryKey';
31
34
  import type {
32
35
  CreateTRPCReactQueryClientConfig,
@@ -37,11 +40,20 @@ import type {
37
40
  import { getQueryClient, getQueryType } from '../shared';
38
41
 
39
42
  type CreateSSGHelpersInternal<TRouter extends AnyRouter> = {
43
+ /**
44
+ * Call this router directly, without HTTP.
45
+ */
40
46
  router: TRouter;
47
+ /**
48
+ * The context to call procedures with.
49
+ */
41
50
  ctx: inferRouterContext<TRouter>;
42
51
  } & TransformerOptions<inferClientTypes<TRouter>>;
43
52
 
44
53
  interface CreateSSGHelpersExternal<TRouter extends AnyRouter> {
54
+ /**
55
+ * Call procedures through this tRPC client.
56
+ */
45
57
  client: TRPCClient<TRouter> | TRPCUntypedClient<TRouter>;
46
58
  }
47
59
 
@@ -76,8 +88,13 @@ type DecoratedProcedureSSGRecord<
76
88
  type AnyDecoratedProcedure = Pick<DecorateQueryProcedure<any, any>, SSGFns>;
77
89
 
78
90
  /**
79
- * Create functions you can use for server-side rendering / static generation
80
- * @see https://trpc.io/docs/v11/client/nextjs/server-side-helpers
91
+ * Creates helpers that fetch or prefetch queries on the server, for
92
+ * server-side rendering and static generation.
93
+ *
94
+ * @deprecated `@trpc/react-query` only gets bug fixes and will be removed in
95
+ * the next major version. Use `@trpc/tanstack-react-query` instead.
96
+ * @see https://trpc.io/docs/client/tanstack-react-query/migrating
97
+ * @see https://trpc.io/docs/client/nextjs/pages-router/server-side-helpers
81
98
  */
82
99
  export function createServerSideHelpers<TRouter extends AnyRouter>(
83
100
  opts: CreateServerSideHelpersOptions<TRouter>,
@@ -168,6 +185,20 @@ export function createServerSideHelpers<TRouter extends AnyRouter>(
168
185
  const queryFn = () =>
169
186
  resolvedOpts.query({ path: arrayPath.join('.'), input });
170
187
 
188
+ const infiniteQueryFn = ({
189
+ pageParam,
190
+ direction,
191
+ }: QueryFunctionContext<TRPCQueryKey, unknown>) => {
192
+ const initialCursor = (args[1] as Maybe<{ initialCursor?: unknown }>)
193
+ ?.initialCursor;
194
+ const [path, infiniteInput] = getClientArgs(
195
+ [arrayPath, { input }],
196
+ undefined,
197
+ { pageParam: pageParam ?? initialCursor, direction },
198
+ );
199
+ return resolvedOpts.query({ path, input: infiniteInput });
200
+ };
201
+
171
202
  const queryKey = getQueryKeyInternal(
172
203
  arrayPath,
173
204
  input,
@@ -181,7 +212,12 @@ export function createServerSideHelpers<TRouter extends AnyRouter>(
181
212
  },
182
213
  infiniteQueryOptions: () => {
183
214
  const args1 = args[1] as Maybe<any>;
184
- return { ...args1, queryKey, queryFn };
215
+ return {
216
+ ...args1,
217
+ queryKey,
218
+ queryFn: infiniteQueryFn,
219
+ initialPageParam: args1?.initialCursor ?? null,
220
+ };
185
221
  },
186
222
  fetch: () => {
187
223
  const args1 = args[1] as Maybe<TRPCFetchQueryOptions<any, any>>;
@@ -194,7 +230,7 @@ export function createServerSideHelpers<TRouter extends AnyRouter>(
194
230
  return queryClient.fetchInfiniteQuery({
195
231
  ...args1,
196
232
  queryKey,
197
- queryFn,
233
+ queryFn: infiniteQueryFn,
198
234
  initialPageParam: args1?.initialCursor ?? null,
199
235
  });
200
236
  },
@@ -209,7 +245,7 @@ export function createServerSideHelpers<TRouter extends AnyRouter>(
209
245
  return queryClient.prefetchInfiniteQuery({
210
246
  ...args1,
211
247
  queryKey,
212
- queryFn,
248
+ queryFn: infiniteQueryFn,
213
249
  initialPageParam: args1?.initialCursor ?? null,
214
250
  });
215
251
  },
@@ -35,10 +35,17 @@ import {
35
35
  useHookResult,
36
36
  } from '../../internals/trpcResult';
37
37
  import type {
38
+ QueriesResults,
38
39
  TRPCUseQueries,
39
40
  TRPCUseSuspenseQueries,
41
+ UseQueryOptionsForUseQueries,
42
+ UseQueryOptionsForUseSuspenseQueries,
40
43
  } from '../../internals/useQueries';
41
44
  import { createUtilityFunctions } from '../../utils/createUtilityFunctions';
45
+ import type {
46
+ UseQueriesProcedureRecord,
47
+ UseSuspenseQueriesProcedureRecord,
48
+ } from '../proxy/useQueriesProxy';
42
49
  import { createUseQueries } from '../proxy/useQueriesProxy';
43
50
  import type { CreateTRPCReactOptions, UseMutationOverride } from '../types';
44
51
  import type {
@@ -698,7 +705,21 @@ export function createRootHooks<
698
705
  return [hook.data!, hook as any];
699
706
  }
700
707
 
701
- const useQueries: TRPCUseQueries<TRouter> = (queriesCallback, options) => {
708
+ const useQueries: TRPCUseQueries<TRouter> = (
709
+ queriesCallback: (
710
+ t: UseQueriesProcedureRecord<
711
+ TRouter['_def']['_config']['$types'],
712
+ TRouter['_def']['record']
713
+ >,
714
+ ) => readonly UseQueryOptionsForUseQueries<any, any, any, any>[],
715
+ options?: {
716
+ combine?: (
717
+ results: QueriesResults<
718
+ UseQueryOptionsForUseQueries<any, any, any, any>[]
719
+ >,
720
+ ) => unknown;
721
+ },
722
+ ) => {
702
723
  const { ssrState, queryClient, prefetchQuery, client } = useContext();
703
724
 
704
725
  const proxy = createUseQueries(client);
@@ -730,7 +751,12 @@ export function createRootHooks<
730
751
  };
731
752
 
732
753
  const useSuspenseQueries: TRPCUseSuspenseQueries<TRouter> = (
733
- queriesCallback,
754
+ queriesCallback: (
755
+ t: UseSuspenseQueriesProcedureRecord<
756
+ TRouter['_def']['_config']['$types'],
757
+ TRouter['_def']['record']
758
+ >,
759
+ ) => readonly UseQueryOptionsForUseSuspenseQueries<any, any, any, any>[],
734
760
  ) => {
735
761
  const { queryClient, client } = useContext();
736
762