File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " create-t3-app " : minor
3
+ ---
4
+
5
+ add inference helper for v10
Original file line number Diff line number Diff line change 1
1
// src/utils/trpc.ts
2
+ import superjson from "superjson" ;
3
+
2
4
import { httpBatchLink , loggerLink } from "@trpc/client" ;
3
5
import { createTRPCNext } from "@trpc/next" ;
6
+ import type { GetInferenceHelpers } from "@trpc/server" ;
7
+
4
8
import type { AppRouter } from "../server/trpc/router/_app" ;
5
- import superjson from "superjson" ;
6
9
7
10
const getBaseUrl = ( ) => {
8
11
if ( typeof window !== "undefined" ) return "" ; // browser should use relative url
@@ -28,3 +31,9 @@ export const trpc = createTRPCNext<AppRouter>({
28
31
} ,
29
32
ssr : false ,
30
33
} ) ;
34
+
35
+ /**
36
+ * Inference helpers
37
+ * @example type HelloOutput = AppRouterTypes['example']['hello']['output']
38
+ **/
39
+ export type AppRouterTypes = GetInferenceHelpers < AppRouter > ;
You can’t perform that action at this time.
0 commit comments