File tree 1 file changed +17
-2
lines changed
1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,21 @@ import { createReactQueryHooks } from "@trpc/react";
5
5
export const trpc = createReactQueryHooks < AppRouter > ( ) ;
6
6
7
7
/**
8
- * Check out tRPC docs for Inference Helpers
9
- * https://trpc.io/docs/infer-types#inference-helpers
8
+ * This is a helper method to infer the output of a query resolver
9
+ * @example type HelloOutput = inferQueryOutput<'hello'>
10
10
*/
11
+ export type inferQueryOutput <
12
+ TRouteKey extends keyof AppRouter [ "_def" ] [ "queries" ] ,
13
+ > = inferProcedureOutput < AppRouter [ "_def" ] [ "queries" ] [ TRouteKey ] > ;
14
+
15
+ export type inferQueryInput <
16
+ TRouteKey extends keyof AppRouter [ "_def" ] [ "queries" ] ,
17
+ > = inferProcedureInput < AppRouter [ "_def" ] [ "queries" ] [ TRouteKey ] > ;
18
+
19
+ export type inferMutationOutput <
20
+ TRouteKey extends keyof AppRouter [ "_def" ] [ "mutations" ] ,
21
+ > = inferProcedureOutput < AppRouter [ "_def" ] [ "mutations" ] [ TRouteKey ] > ;
22
+
23
+ export type inferMutationInput <
24
+ TRouteKey extends keyof AppRouter [ "_def" ] [ "mutations" ] ,
25
+ > = inferProcedureInput < AppRouter [ "_def" ] [ "mutations" ] [ TRouteKey ] > ;
You can’t perform that action at this time.
0 commit comments