@trpc/react-query 11.0.0-alpha-tmp-nosideeffects.257 → 11.0.0-alpha-tmp-02-08-tmp.274

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.
@@ -101,7 +101,7 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
101
101
  }
102
102
  }, queryClient);
103
103
  hook.trpc = useHookResult({
104
- path: path.join('.')
104
+ path
105
105
  });
106
106
  return hook;
107
107
  }
@@ -124,7 +124,7 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
124
124
  }
125
125
  }, context.queryClient);
126
126
  hook.trpc = useHookResult({
127
- path: path.join('.')
127
+ path
128
128
  });
129
129
  return [
130
130
  hook.data,
@@ -159,7 +159,7 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
159
159
  }
160
160
  }, queryClient);
161
161
  hook.trpc = useHookResult({
162
- path: path.join('.')
162
+ path
163
163
  });
164
164
  return hook;
165
165
  }
@@ -238,7 +238,7 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
238
238
  }
239
239
  }, queryClient);
240
240
  hook.trpc = useHookResult({
241
- path: path.join('.')
241
+ path
242
242
  });
243
243
  return hook;
244
244
  }
@@ -270,7 +270,7 @@ import { createUseQueries } from '../proxy/useQueriesProxy.mjs';
270
270
  }
271
271
  }, context.queryClient);
272
272
  hook.trpc = useHookResult({
273
- path: path.join('.')
273
+ path
274
274
  });
275
275
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
276
276
  return [
@@ -4,7 +4,6 @@ import type { AnyRouter, DistributiveOmit } from '@trpc/server/unstable-core-do-
4
4
  import type { ReactNode } from 'react';
5
5
  import type { TRPCContextProps } from '../../internals/context';
6
6
  import type { TRPCQueryKey } from '../../internals/getQueryKey';
7
- import type { TRPCHookResult } from '../../internals/useHookResult';
8
7
  export type OutputWithCursor<TData, TCursor = any> = {
9
8
  cursor: TCursor | null;
10
9
  data: TData;
@@ -97,4 +96,9 @@ export type UseTRPCSuspenseInfiniteQueryResult<TData, TError, TInput> = [
97
96
  * @internal
98
97
  */
99
98
  export type UseTRPCMutationResult<TData, TError, TVariables, TContext> = TRPCHookResult & UseMutationResult<TData, TError, TVariables, TContext>;
99
+ export interface TRPCHookResult {
100
+ trpc: {
101
+ path: string;
102
+ };
103
+ }
100
104
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shared/hooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,kCAAkC,EAClC,mBAAmB,EACnB,0BAA0B,EAC1B,YAAY,EACZ,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,+BAA+B,EAC/B,8BAA8B,EAC9B,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EACjB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,MAAM,MAAM,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,GAAG,IAAI;IACnD,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,KAAK,CAAC;CACb,CAAC;AAEF,MAAM,WAAW,uBAEf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC1C;;OAEG;I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AG,cAAc;CACvD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0BAA0B,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,cAAc,GAC5E,sBAAsB,CACpB,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,EAClE,MAAM,CACP,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,iCAAiC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,IACjE,kCAAkC,CAChC,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,EAClE,MAAM,CACP,GACC,cAAc,CAAC;AAEnB;;GAEG;AACH,MAAM,MAAM,kCAAkC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI;IACtE,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;IAClE,8BAA8B,CAC5B,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,EAClE,MAAM,CACP,GACC,cAAc;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,IACnE,cAAc,GAAG,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAE1E,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH"}
@@ -1,5 +1,6 @@
1
1
  import type { TRPCClientErrorLike } from '@trpc/client';
2
2
  import type { AnyProcedure, AnyRootTypes, inferProcedureInput, inferProcedureOutput, inferTransformedProcedureOutput } from '@trpc/server/unstable-core-do-not-import';
3
+ import type { DecoratedQuery } from '../../createTRPCReact';
3
4
  import type { InferQueryOptions, InferQueryResult } from '../../utils/inferReactQueryProcedure';
4
5
  import type { UseTRPCSuspenseQueryResult } from '../hooks/types';
5
6
  /**
@@ -12,9 +13,9 @@ export type QueryLike<TRoot extends AnyRootTypes, TProcedure extends AnyProcedur
12
13
  /**
13
14
  * Use to unwrap a QueryLike's input
14
15
  */
15
- export type InferQueryLikeInput<TQueryLike extends QueryLike<any, any>> = TQueryLike extends QueryLike<any, infer TProcedure> ? inferProcedureInput<TProcedure> : never;
16
+ export type InferQueryLikeInput<TQueryLike> = TQueryLike extends DecoratedQuery<infer $Def> ? $Def['input'] : TQueryLike extends QueryLike<any, infer TProcedure> ? inferProcedureInput<TProcedure> : never;
16
17
  /**
17
18
  * Use to unwrap a QueryLike's data output
18
19
  */
19
- export type InferQueryLikeData<TQueryLike extends QueryLike<any, any>> = TQueryLike extends QueryLike<infer TRoot, infer TProcedure> ? inferTransformedProcedureOutput<TRoot, TProcedure> : never;
20
+ export type InferQueryLikeData<TQueryLike> = TQueryLike extends DecoratedQuery<infer $Def> ? $Def['output'] : TQueryLike extends QueryLike<infer TRoot, infer TProcedure> ? inferTransformedProcedureOutput<TRoot, TProcedure> : never;
20
21
  //# sourceMappingURL=queryLike.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"queryLike.d.ts","sourceRoot":"","sources":["../../../src/shared/polymorphism/queryLike.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,+BAA+B,EAChC,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,SAAS,CACnB,KAAK,SAAS,YAAY,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effects.257+d4a143f03",
3
+ "version": "11.0.0-alpha-tmp-02-08-tmp.274+fc6e807b1",
4
4
  "description": "The tRPC React library",
5
5
  "author": "KATT",
6
6
  "license": "MIT",
@@ -58,15 +58,15 @@
58
58
  },
59
59
  "peerDependencies": {
60
60
  "@tanstack/react-query": "^5.0.0",
61
- "@trpc/client": "11.0.0-alpha-tmp-nosideeffects.257+d4a143f03",
62
- "@trpc/server": "11.0.0-alpha-tmp-nosideeffects.257+d4a143f03",
61
+ "@trpc/client": "11.0.0-alpha-tmp-02-08-tmp.274+fc6e807b1",
62
+ "@trpc/server": "11.0.0-alpha-tmp-02-08-tmp.274+fc6e807b1",
63
63
  "react": ">=18.2.0",
64
64
  "react-dom": ">=18.2.0"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@tanstack/react-query": "^5.0.0",
68
- "@trpc/client": "11.0.0-alpha-tmp-nosideeffects.257+d4a143f03",
69
- "@trpc/server": "11.0.0-alpha-tmp-nosideeffects.257+d4a143f03",
68
+ "@trpc/client": "11.0.0-alpha-tmp-02-08-tmp.274+fc6e807b1",
69
+ "@trpc/server": "11.0.0-alpha-tmp-02-08-tmp.274+fc6e807b1",
70
70
  "@types/express": "^4.17.17",
71
71
  "@types/node": "^20.10.0",
72
72
  "@types/react": "^18.2.33",
@@ -85,5 +85,5 @@
85
85
  "funding": [
86
86
  "https://trpc.io/sponsor"
87
87
  ],
88
- "gitHead": "d4a143f039d39e3cd2623797c7e797a58a8f7066"
88
+ "gitHead": "fc6e807b19d0b6fc726daa0a58ff5fcefcbef3d2"
89
89
  }
@@ -1,14 +1,11 @@
1
1
  import type { TRPCClientErrorLike } from '@trpc/client';
2
2
  import type {
3
- AnyMutationProcedure,
4
3
  AnyProcedure,
5
- AnyQueryProcedure,
6
4
  AnyRootTypes,
7
5
  AnyRouter,
8
- AnySubscriptionProcedure,
9
6
  inferProcedureInput,
10
7
  inferTransformedProcedureOutput,
11
- inferTransformedSubscriptionOutput,
8
+ ProcedureType,
12
9
  ProtectedIntersection,
13
10
  RouterRecord,
14
11
  } from '@trpc/server/unstable-core-do-not-import';
@@ -41,44 +38,44 @@ import type {
41
38
  } from './shared/hooks/types';
42
39
  import type { CreateTRPCReactOptions } from './shared/types';
43
40
 
41
+ type ResolverDef = {
42
+ input: any;
43
+ output: any;
44
+ transformer: boolean;
45
+ errorShape: any;
46
+ };
44
47
  /**
45
48
  * @internal
46
49
  */
47
- export interface ProcedureUseQuery<
48
- TRoot extends AnyRootTypes,
49
- TProcedure extends AnyProcedure,
50
- > {
51
- <
52
- TQueryFnData extends inferTransformedProcedureOutput<
53
- TRoot,
54
- TProcedure
55
- > = inferTransformedProcedureOutput<TRoot, TProcedure>,
56
- TData = TQueryFnData,
57
- >(
58
- input: inferProcedureInput<TProcedure>,
50
+ export interface ProcedureUseQuery<TDef extends ResolverDef> {
51
+ <TQueryFnData extends TDef['output'] = TDef['output'], TData = TQueryFnData>(
52
+ input: TDef['input'],
59
53
  opts: DefinedUseTRPCQueryOptions<
60
54
  TQueryFnData,
61
55
  TData,
62
- TRPCClientErrorLike<TRoot>,
63
- inferTransformedProcedureOutput<TRoot, TProcedure>
56
+ TRPCClientErrorLike<{
57
+ errorShape: TDef['errorShape'];
58
+ transformer: TDef['transformer'];
59
+ }>,
60
+ TDef['output']
64
61
  >,
65
- ): DefinedUseTRPCQueryResult<TData, TRPCClientErrorLike<TRoot>>;
62
+ ): DefinedUseTRPCQueryResult<
63
+ TData,
64
+ TRPCClientErrorLike<{
65
+ errorShape: TDef['errorShape'];
66
+ transformer: TDef['transformer'];
67
+ }>
68
+ >;
66
69
 
67
- <
68
- TQueryFnData extends inferTransformedProcedureOutput<
69
- TRoot,
70
- TProcedure
71
- > = inferTransformedProcedureOutput<TRoot, TProcedure>,
72
- TData = TQueryFnData,
73
- >(
74
- input: inferProcedureInput<TProcedure>,
70
+ <TQueryFnData extends TDef['output'] = TDef['output'], TData = TQueryFnData>(
71
+ input: TDef['input'],
75
72
  opts?: UseTRPCQueryOptions<
76
73
  TQueryFnData,
77
74
  TData,
78
- TRPCClientErrorLike<TRoot>,
79
- inferTransformedProcedureOutput<TRoot, TProcedure>
75
+ TRPCClientErrorLike<TDef>,
76
+ TDef['output']
80
77
  >,
81
- ): UseTRPCQueryResult<TData, TRPCClientErrorLike<TRoot>>;
78
+ ): UseTRPCQueryResult<TData, TRPCClientErrorLike<TDef>>;
82
79
  }
83
80
 
84
81
  /**
@@ -91,129 +88,110 @@ type CursorInput = {
91
88
  /**
92
89
  * @internal
93
90
  */
94
- export type MaybeDecoratedInfiniteQuery<
95
- TProcedure extends AnyProcedure,
96
- TRoot extends AnyRootTypes,
97
- > = inferProcedureInput<TProcedure> extends CursorInput
98
- ? {
99
- /**
100
- * @link https://trpc.io/docs/v11/client/react/suspense#useinfinitesuspensequery
101
- */
102
- useInfiniteQuery: (
103
- input: Omit<inferProcedureInput<TProcedure>, 'cursor'>,
104
- opts: UseTRPCInfiniteQueryOptions<
105
- inferProcedureInput<TProcedure>,
106
- inferTransformedProcedureOutput<TRoot, TProcedure>,
107
- TRPCClientErrorLike<TRoot>
108
- >,
109
- ) => UseTRPCInfiniteQueryResult<
110
- inferTransformedProcedureOutput<TRoot, TProcedure>,
111
- TRPCClientErrorLike<TRoot>,
112
- inferProcedureInput<TProcedure>
113
- >;
114
- /**
115
- * @link https://trpc.io/docs/v11/client/react/suspense
116
- */
117
- useSuspenseInfiniteQuery: (
118
- input: Omit<inferProcedureInput<TProcedure>, 'cursor'>,
119
- opts: UseTRPCSuspenseInfiniteQueryOptions<
120
- inferProcedureInput<TProcedure>,
121
- inferTransformedProcedureOutput<TRoot, TProcedure>,
122
- TRPCClientErrorLike<TRoot>
123
- >,
124
- ) => UseTRPCSuspenseInfiniteQueryResult<
125
- inferTransformedProcedureOutput<TRoot, TProcedure>,
126
- TRPCClientErrorLike<TRoot>,
127
- inferProcedureInput<TProcedure>
128
- >;
129
- }
130
- : object;
91
+ export type MaybeDecoratedInfiniteQuery<TDef extends ResolverDef> =
92
+ TDef['input'] extends CursorInput
93
+ ? {
94
+ /**
95
+ * @link https://trpc.io/docs/v11/client/react/suspense#useinfinitesuspensequery
96
+ */
97
+ useInfiniteQuery: (
98
+ input: Omit<TDef['input'], 'cursor'>,
99
+ opts: UseTRPCInfiniteQueryOptions<
100
+ TDef['input'],
101
+ TDef['output'],
102
+ TRPCClientErrorLike<TDef>
103
+ >,
104
+ ) => UseTRPCInfiniteQueryResult<
105
+ TDef['output'],
106
+ TRPCClientErrorLike<TDef>,
107
+ TDef['input']
108
+ >;
109
+ /**
110
+ * @link https://trpc.io/docs/v11/client/react/suspense
111
+ */
112
+ useSuspenseInfiniteQuery: (
113
+ input: Omit<TDef['input'], 'cursor'>,
114
+ opts: UseTRPCSuspenseInfiniteQueryOptions<
115
+ TDef['input'],
116
+ TDef['output'],
117
+ TRPCClientErrorLike<TDef>
118
+ >,
119
+ ) => UseTRPCSuspenseInfiniteQueryResult<
120
+ TDef['output'],
121
+ TRPCClientErrorLike<TDef>,
122
+ TDef['input']
123
+ >;
124
+ }
125
+ : object;
131
126
 
132
127
  /**
133
128
  * @internal
134
129
  */
135
- export type DecoratedQueryMethods<
136
- TRoot extends AnyRootTypes,
137
- TProcedure extends AnyProcedure,
138
- > = {
130
+ export type DecoratedQueryMethods<TDef extends ResolverDef> = {
139
131
  /**
140
132
  * @link https://trpc.io/docs/v11/client/react/useQuery
141
133
  */
142
- useQuery: ProcedureUseQuery<TRoot, TProcedure>;
134
+ useQuery: ProcedureUseQuery<TDef>;
143
135
  /**
144
136
  * @link https://trpc.io/docs/v11/client/react/suspense#usesuspensequery
145
137
  */
146
138
  useSuspenseQuery: <
147
- TQueryFnData extends inferTransformedProcedureOutput<
148
- TRoot,
149
- TProcedure
150
- > = inferTransformedProcedureOutput<TRoot, TProcedure>,
139
+ TQueryFnData extends TDef['output'] = TDef['output'],
151
140
  TData = TQueryFnData,
152
141
  >(
153
- input: inferProcedureInput<TProcedure>,
142
+ input: TDef['input'],
154
143
  opts?: UseTRPCSuspenseQueryOptions<
155
144
  TQueryFnData,
156
145
  TData,
157
- TRPCClientErrorLike<TRoot>
146
+ TRPCClientErrorLike<TDef>
158
147
  >,
159
- ) => UseTRPCSuspenseQueryResult<TData, TRPCClientErrorLike<TRoot>>;
148
+ ) => UseTRPCSuspenseQueryResult<TData, TRPCClientErrorLike<TDef>>;
160
149
  };
161
150
 
162
151
  /**
163
152
  * @internal
164
153
  */
165
- export type DecoratedQuery<
166
- TRoot extends AnyRootTypes,
167
- TProcedure extends AnyProcedure,
168
- > = MaybeDecoratedInfiniteQuery<TProcedure, TRoot> &
169
- DecoratedQueryMethods<TRoot, TProcedure>;
154
+ export type DecoratedQuery<TDef extends ResolverDef> =
155
+ MaybeDecoratedInfiniteQuery<TDef> & DecoratedQueryMethods<TDef>;
170
156
 
171
- /**
172
- * @internal
173
- */
174
- export interface DecoratedMutation<
175
- TRoot extends AnyRootTypes,
176
- TProcedure extends AnyProcedure,
177
- > {
157
+ export type DecoratedMutation<TDef extends ResolverDef> = {
178
158
  /**
179
159
  * @link https://trpc.io/docs/v11/client/react/useMutation
180
160
  */
181
161
  useMutation: <TContext = unknown>(
182
162
  opts?: UseTRPCMutationOptions<
183
- inferProcedureInput<TProcedure>,
184
- TRPCClientErrorLike<TRoot>,
185
- inferTransformedProcedureOutput<TRoot, TProcedure>,
163
+ TDef['input'],
164
+ TRPCClientErrorLike<TDef>,
165
+ TDef['output'],
186
166
  TContext
187
167
  >,
188
168
  ) => UseTRPCMutationResult<
189
- inferTransformedProcedureOutput<TRoot, TProcedure>,
190
- TRPCClientErrorLike<TRoot>,
191
- inferProcedureInput<TProcedure>,
169
+ TDef['output'],
170
+ TRPCClientErrorLike<TDef>,
171
+ TDef['input'],
192
172
  TContext
193
173
  >;
194
- }
195
-
174
+ };
196
175
  /**
197
176
  * @internal
198
177
  */
199
178
  export type DecorateProcedure<
200
- TRoot extends AnyRootTypes,
201
- TProcedure extends AnyProcedure,
202
- _TFlags,
203
- > = TProcedure extends AnyQueryProcedure
204
- ? DecoratedQuery<TRoot, TProcedure>
205
- : TProcedure extends AnyMutationProcedure
206
- ? DecoratedMutation<TRoot, TProcedure>
207
- : TProcedure extends AnySubscriptionProcedure
179
+ TType extends ProcedureType,
180
+ TDef extends ResolverDef,
181
+ > = TType extends 'query'
182
+ ? DecoratedQuery<TDef>
183
+ : TType extends 'mutation'
184
+ ? DecoratedMutation<TDef>
185
+ : TType extends 'subscription'
208
186
  ? {
209
187
  /**
210
188
  * @link https://trpc.io/docs/v11/subscriptions
211
189
  */
212
190
  useSubscription: (
213
- input: inferProcedureInput<TProcedure>,
191
+ input: TDef['input'],
214
192
  opts?: UseTRPCSubscriptionOptions<
215
- inferTransformedSubscriptionOutput<TRoot, TProcedure>,
216
- TRPCClientErrorLike<TRoot>
193
+ TDef['output'],
194
+ TRPCClientErrorLike<TDef>
217
195
  >,
218
196
  ) => void;
219
197
  }
@@ -225,13 +203,20 @@ export type DecorateProcedure<
225
203
  export type DecorateRouterRecord<
226
204
  TRoot extends AnyRootTypes,
227
205
  TRecord extends RouterRecord,
228
- TFlags,
229
206
  > = {
230
207
  [TKey in keyof TRecord]: TRecord[TKey] extends infer $Value
231
208
  ? $Value extends RouterRecord
232
- ? DecorateRouterRecord<TRoot, $Value, TFlags>
209
+ ? DecorateRouterRecord<TRoot, $Value>
233
210
  : $Value extends AnyProcedure
234
- ? DecorateProcedure<TRoot, $Value, TFlags>
211
+ ? DecorateProcedure<
212
+ $Value['_def']['type'],
213
+ {
214
+ input: inferProcedureInput<$Value>;
215
+ output: inferTransformedProcedureOutput<TRoot, $Value>;
216
+ transformer: TRoot['transformer'];
217
+ errorShape: TRoot['errorShape'];
218
+ }
219
+ >
235
220
  : never
236
221
  : never;
237
222
  };
@@ -259,13 +244,11 @@ export type CreateTRPCReactBase<TRouter extends AnyRouter, TSSRContext> = {
259
244
  export type CreateTRPCReact<
260
245
  TRouter extends AnyRouter,
261
246
  TSSRContext,
262
- TFlags,
263
247
  > = ProtectedIntersection<
264
248
  CreateTRPCReactBase<TRouter, TSSRContext>,
265
249
  DecorateRouterRecord<
266
250
  TRouter['_def']['_config']['$types'],
267
- TRouter['_def']['record'],
268
- TFlags
251
+ TRouter['_def']['record']
269
252
  >
270
253
  >;
271
254
 
@@ -275,9 +258,8 @@ export type CreateTRPCReact<
275
258
  export function createHooksInternal<
276
259
  TRouter extends AnyRouter,
277
260
  TSSRContext = unknown,
278
- TFlags = null,
279
261
  >(trpc: CreateReactQueryHooks<TRouter, TSSRContext>) {
280
- type CreateHooksInternal = CreateTRPCReact<TRouter, TSSRContext, TFlags>;
262
+ type CreateHooksInternal = CreateTRPCReact<TRouter, TSSRContext>;
281
263
 
282
264
  return createFlatProxy<CreateHooksInternal>((key) => {
283
265
  if (key === 'useContext' || key === 'useUtils') {
@@ -301,12 +283,11 @@ export function createHooksInternal<
301
283
  export function createTRPCReact<
302
284
  TRouter extends AnyRouter,
303
285
  TSSRContext = unknown,
304
- TFlags = null,
305
286
  >(
306
287
  opts?: CreateTRPCReactOptions<TRouter>,
307
- ): CreateTRPCReact<TRouter, TSSRContext, TFlags> {
288
+ ): CreateTRPCReact<TRouter, TSSRContext> {
308
289
  const hooks = createRootHooks<TRouter, TSSRContext>(opts);
309
- const proxy = createHooksInternal<TRouter, TSSRContext, TFlags>(hooks);
290
+ const proxy = createHooksInternal<TRouter, TSSRContext>(hooks);
310
291
 
311
292
  return proxy as any;
312
293
  }
@@ -1,12 +1,6 @@
1
- import type {
2
- AnyMutationProcedure,
3
- AnyQueryProcedure,
4
- AnyRootTypes,
5
- AnyRouter,
6
- DeepPartial,
7
- inferProcedureInput,
8
- } from '@trpc/server/unstable-core-do-not-import';
9
- import type { DecorateProcedure, DecorateRouterRecord } from '../shared';
1
+ import type { DeepPartial } from '@trpc/server/unstable-core-do-not-import';
2
+ import type { DecoratedMutation, DecoratedQuery } from '../createTRPCReact';
3
+ import type { DecorateRouterRecord } from '../shared';
10
4
 
11
5
  export type QueryType = 'any' | 'infinite' | 'query';
12
6
 
@@ -15,6 +9,11 @@ export type TRPCQueryKey = [
15
9
  { input?: unknown; type?: Exclude<QueryType, 'any'> }?,
16
10
  ];
17
11
 
12
+ type ProcedureOrRouter =
13
+ | DecoratedMutation<any>
14
+ | DecoratedQuery<any>
15
+ | DecorateRouterRecord<any, any>;
16
+
18
17
  /**
19
18
  * To allow easy interactions with groups of related queries, such as
20
19
  * invalidating all queries of a router, we use an array as the path when
@@ -77,45 +76,10 @@ export type GetQueryProcedureInput<TProcedureInput> = TProcedureInput extends {
77
76
  ? GetInfiniteQueryInput<TProcedureInput>
78
77
  : DeepPartial<TProcedureInput> | undefined;
79
78
 
80
- type GetQueryParams<
81
- TProcedureOrRouter extends AnyQueryProcedure,
82
- TProcedureInput = inferProcedureInput<TProcedureOrRouter>,
83
- > = TProcedureInput extends undefined
84
- ? []
85
- : [input?: GetQueryProcedureInput<TProcedureInput>, type?: QueryType];
86
-
87
- type GetParams<
88
- TRoot extends AnyRootTypes,
89
- TProcedureOrRouter extends
90
- | AnyMutationProcedure
91
- | AnyQueryProcedure
92
- | AnyRouter,
93
- TFlags,
94
- > = TProcedureOrRouter extends AnyQueryProcedure
95
- ? [
96
- procedureOrRouter: DecorateProcedure<TRoot, TProcedureOrRouter, TFlags>,
97
- ..._params: GetQueryParams<TProcedureOrRouter>,
98
- ]
99
- : TProcedureOrRouter extends AnyMutationProcedure
100
- ? [procedureOrRouter: DecorateProcedure<TRoot, TProcedureOrRouter, TFlags>]
101
- : TProcedureOrRouter extends AnyRouter
102
- ? [
103
- procedureOrRouter: DecorateRouterRecord<
104
- TRoot,
105
- TProcedureOrRouter['_def']['record'],
106
- TFlags
107
- >,
108
- ]
109
- : never;
110
-
111
- type GetQueryKeyParams<
112
- TRoot extends AnyRootTypes,
113
- TProcedureOrRouter extends
114
- | AnyMutationProcedure
115
- | AnyQueryProcedure
116
- | AnyRouter,
117
- TFlags,
118
- > = GetParams<TRoot, TProcedureOrRouter, TFlags>;
79
+ type GetParams<TProcedureOrRouter extends ProcedureOrRouter> =
80
+ TProcedureOrRouter extends DecoratedQuery<infer $Def>
81
+ ? [input?: GetQueryProcedureInput<$Def['input']>, type?: QueryType]
82
+ : [];
119
83
 
120
84
  /**
121
85
  * Method to extract the query key for a procedure
@@ -124,15 +88,12 @@ type GetQueryKeyParams<
124
88
  * @param type - defaults to `any`
125
89
  * @link https://trpc.io/docs/v11/getQueryKey
126
90
  */
127
- export function getQueryKey<
128
- TRoot extends AnyRootTypes,
129
- TProcedureOrRouter extends
130
- | AnyMutationProcedure
131
- | AnyQueryProcedure
132
- | AnyRouter,
133
- TFlags,
134
- >(..._params: GetQueryKeyParams<TRoot, TProcedureOrRouter, TFlags>) {
135
- const [procedureOrRouter, input, type] = _params;
91
+ export function getQueryKey<TProcedureOrRouter extends ProcedureOrRouter>(
92
+ procedureOrRouter: TProcedureOrRouter,
93
+ ..._params: GetParams<TProcedureOrRouter>
94
+ ) {
95
+ const [input, type] = _params;
96
+
136
97
  // @ts-expect-error - we don't expose _def on the type layer
137
98
  const path = procedureOrRouter._def().path as string[];
138
99
  const queryKey = getQueryKeyInternal(path, input, type ?? 'any');
@@ -1,18 +1,17 @@
1
1
  import * as React from 'react';
2
-
3
- export interface TRPCHookResult {
4
- trpc: {
5
- path: string;
6
- };
7
- }
2
+ import type { TRPCHookResult } from '../shared/hooks/types';
8
3
 
9
4
  /**
10
5
  * Makes a stable reference of the `trpc` prop
11
6
  */
12
- export function useHookResult(
13
- value: TRPCHookResult['trpc'],
14
- ): TRPCHookResult['trpc'] {
15
- const ref = React.useRef(value);
16
- ref.current.path = value.path;
17
- return ref.current;
7
+ export function useHookResult(value: {
8
+ path: string[];
9
+ }): TRPCHookResult['trpc'] {
10
+ const path = value.path.join('.');
11
+ return React.useMemo(
12
+ () => ({
13
+ path,
14
+ }),
15
+ [path],
16
+ );
18
17
  }
@@ -17,8 +17,8 @@ import type {
17
17
  AnyQueryProcedure,
18
18
  AnyRootTypes,
19
19
  AnyRouter,
20
+ inferClientTypes,
20
21
  inferProcedureInput,
21
- inferRootTypes,
22
22
  inferRouterContext,
23
23
  inferTransformedProcedureOutput,
24
24
  Maybe,
@@ -42,7 +42,7 @@ import { getQueryClient, getQueryType } from '../shared';
42
42
  type CreateSSGHelpersInternal<TRouter extends AnyRouter> = {
43
43
  router: TRouter;
44
44
  ctx: inferRouterContext<TRouter>;
45
- } & TransformerOptions<inferRootTypes<TRouter>>;
45
+ } & TransformerOptions<inferClientTypes<TRouter>>;
46
46
 
47
47
  interface CreateSSGHelpersExternal<TRouter extends AnyRouter> {
48
48
  client: inferRouterClient<TRouter> | TRPCUntypedClient<TRouter>;