File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
www/docs/client/tanstack-react-query Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -231,25 +231,23 @@ function SubscriptionExample() {
231231When you need to infer the input and output types for a procedure or router, there are 2 options available depending on the situation
232232
233233``` ts
234- import { AppRouter } from ' ./path/to/server'
235-
236234//
237235// Infer the input and output types of a full router
238236
239237import type { inferRouterInputs , inferRouterOutputs } from ' @trpc/server' ;
240-
241- export type Inputs = inferRouterInputs <AppRouter >
242- export type Outputs = inferRouterOutputs <AppRouter >
243-
244238//
245239// Infer types for a single procedure
246240
247241import type { inferInput , inferOutput } from ' @trpc/tanstack-react-query' ;
242+ import { AppRouter } from ' ./path/to/server' ;
243+
244+ export type Inputs = inferRouterInputs <AppRouter >;
245+ export type Outputs = inferRouterOutputs <AppRouter >;
248246
249247function Component() {
250- const trpc = useTRPC ()
248+ const trpc = useTRPC ();
251249
252- type Input = inferInput <typeof trpc .path .to .procedure >
253- type Output = inferOutput <typeof trpc .path .to .procedure >
250+ type Input = inferInput <typeof trpc .path .to .procedure >;
251+ type Output = inferOutput <typeof trpc .path .to .procedure >;
254252}
255253```
You can’t perform that action at this time.
0 commit comments