@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.
@@ -182,7 +182,7 @@ export function createRootHooks<
182
182
  ) as UseTRPCQueryResult<unknown, TError>;
183
183
 
184
184
  hook.trpc = useHookResult({
185
- path: path.join('.'),
185
+ path,
186
186
  });
187
187
 
188
188
  return hook;
@@ -221,7 +221,7 @@ export function createRootHooks<
221
221
  ) as UseTRPCQueryResult<unknown, TError>;
222
222
 
223
223
  hook.trpc = useHookResult({
224
- path: path.join('.'),
224
+ path,
225
225
  });
226
226
 
227
227
  return [hook.data, hook as any];
@@ -259,7 +259,7 @@ export function createRootHooks<
259
259
  ) as UseTRPCMutationResult<unknown, TError, unknown, unknown>;
260
260
 
261
261
  hook.trpc = useHookResult({
262
- path: path.join('.'),
262
+ path,
263
263
  });
264
264
 
265
265
  return hook;
@@ -376,7 +376,7 @@ export function createRootHooks<
376
376
  ) as UseTRPCInfiniteQueryResult<unknown, TError, unknown>;
377
377
 
378
378
  hook.trpc = useHookResult({
379
- path: path.join('.'),
379
+ path,
380
380
  });
381
381
  return hook;
382
382
  }
@@ -429,7 +429,7 @@ export function createRootHooks<
429
429
  ) as UseTRPCInfiniteQueryResult<unknown, TError, unknown>;
430
430
 
431
431
  hook.trpc = useHookResult({
432
- path: path.join('.'),
432
+ path,
433
433
  });
434
434
 
435
435
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -29,7 +29,6 @@ import type {
29
29
  import type { ReactNode } from 'react';
30
30
  import type { TRPCContextProps } from '../../internals/context';
31
31
  import type { TRPCQueryKey } from '../../internals/getQueryKey';
32
- import type { TRPCHookResult } from '../../internals/useHookResult';
33
32
 
34
33
  export type OutputWithCursor<TData, TCursor = any> = {
35
34
  cursor: TCursor | null;
@@ -226,3 +225,9 @@ export type UseTRPCSuspenseInfiniteQueryResult<TData, TError, TInput> = [
226
225
  */
227
226
  export type UseTRPCMutationResult<TData, TError, TVariables, TContext> =
228
227
  TRPCHookResult & UseMutationResult<TData, TError, TVariables, TContext>;
228
+
229
+ export interface TRPCHookResult {
230
+ trpc: {
231
+ path: string;
232
+ };
233
+ }
@@ -6,6 +6,7 @@ import type {
6
6
  inferProcedureOutput,
7
7
  inferTransformedProcedureOutput,
8
8
  } from '@trpc/server/unstable-core-do-not-import';
9
+ import type { DecoratedQuery } from '../../createTRPCReact';
9
10
  import type {
10
11
  InferQueryOptions,
11
12
  InferQueryResult,
@@ -36,15 +37,21 @@ export type QueryLike<
36
37
  /**
37
38
  * Use to unwrap a QueryLike's input
38
39
  */
39
- export type InferQueryLikeInput<TQueryLike extends QueryLike<any, any>> =
40
- TQueryLike extends QueryLike<any, infer TProcedure>
41
- ? inferProcedureInput<TProcedure>
42
- : never;
40
+ export type InferQueryLikeInput<TQueryLike> = TQueryLike extends DecoratedQuery<
41
+ infer $Def
42
+ >
43
+ ? $Def['input']
44
+ : TQueryLike extends QueryLike<any, infer TProcedure>
45
+ ? inferProcedureInput<TProcedure>
46
+ : never;
43
47
 
44
48
  /**
45
49
  * Use to unwrap a QueryLike's data output
46
50
  */
47
- export type InferQueryLikeData<TQueryLike extends QueryLike<any, any>> =
48
- TQueryLike extends QueryLike<infer TRoot, infer TProcedure>
49
- ? inferTransformedProcedureOutput<TRoot, TProcedure>
50
- : never;
51
+ export type InferQueryLikeData<TQueryLike> = TQueryLike extends DecoratedQuery<
52
+ infer $Def
53
+ >
54
+ ? $Def['output']
55
+ : TQueryLike extends QueryLike<infer TRoot, infer TProcedure>
56
+ ? inferTransformedProcedureOutput<TRoot, TProcedure>
57
+ : never;
@@ -29,3 +29,15 @@ export type RouterLikeInner<
29
29
  : never
30
30
  : never;
31
31
  };
32
+
33
+ // /**
34
+ // * Use to describe a route path which matches a given route's interface
35
+ // */
36
+ // export type RouterLike<TRouter extends AnyRouter> = RouterLikeInner<
37
+ // TRouter['_def']['_config']['$types'],
38
+ // TRouter['_def']['procedures']
39
+ // >;
40
+ // export type RouterLikeInner<
41
+ // TRoot extends AnyRootTypes,
42
+ // TRecord extends RouterRecord,
43
+ // > = DecorateRouterRecord<TRoot, TRecord>;