const baseProcedure = t.procedure .input(i => i as { townName: string }) .use((opts) => { const input = opts.input; console.log(`Handling request with user from: ${input.townName}`); return opts.next(); }); export const appRouter = t.router({ hello: baseProcedure .input(i => i as { name: string }) .query((opts) => { const input = opts.input; // <-- object with both properties return { greeting: `Hello ${input.name}, my friend from ${input.townName}`, }; }), });
Join the Discord to ask follow-up questions and connect with the community
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
4,951 Members