@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.
- package/dist/bundle-analysis.json +240 -0
- package/dist/createTRPCReact.d.ts +38 -24
- package/dist/createTRPCReact.d.ts.map +1 -1
- package/dist/internals/getQueryKey.d.ts +6 -11
- package/dist/internals/getQueryKey.d.ts.map +1 -1
- package/dist/internals/getQueryKey.js +2 -2
- package/dist/internals/getQueryKey.mjs +2 -2
- package/dist/internals/useHookResult.d.ts +4 -6
- package/dist/internals/useHookResult.d.ts.map +1 -1
- package/dist/internals/useHookResult.js +6 -3
- package/dist/internals/useHookResult.mjs +6 -3
- package/dist/server/ssgProxy.d.ts +2 -2
- package/dist/server/ssgProxy.d.ts.map +1 -1
- package/dist/shared/hooks/createHooksInternal.js +5 -5
- package/dist/shared/hooks/createHooksInternal.mjs +5 -5
- package/dist/shared/hooks/types.d.ts +5 -1
- package/dist/shared/hooks/types.d.ts.map +1 -1
- package/dist/shared/polymorphism/queryLike.d.ts +3 -2
- package/dist/shared/polymorphism/queryLike.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/createTRPCReact.tsx +102 -121
- package/src/internals/getQueryKey.ts +18 -57
- package/src/internals/useHookResult.ts +11 -12
- package/src/server/ssgProxy.ts +2 -2
- package/src/shared/hooks/createHooksInternal.tsx +5 -5
- package/src/shared/hooks/types.ts +6 -1
- package/src/shared/polymorphism/queryLike.ts +15 -8
- package/src/shared/polymorphism/routerLike.ts +12 -0
|
@@ -182,7 +182,7 @@ export function createRootHooks<
|
|
|
182
182
|
) as UseTRPCQueryResult<unknown, TError>;
|
|
183
183
|
|
|
184
184
|
hook.trpc = useHookResult({
|
|
185
|
-
path
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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>;
|