T
tRPC

what is "use" keyword

what is "use" keyword

AGAyush Goyal7/27/2023
const baseProcedure = t.procedure
.input(z.object({ townName: z.string() }))
.use((opts) => {
const input = opts.input;

const input: {
townName: string;
}

console.log(`Handling request with user from: ${input.townName}`);

return opts.next();
});
const baseProcedure = t.procedure
.input(z.object({ townName: z.string() }))
.use((opts) => {
const input = opts.input;

const input: {
townName: string;
}

console.log(`Handling request with user from: ${input.townName}`);

return opts.next();
});
what is this usekeyword any place i can read about it
AGAyush Goyal7/27/2023
i guess whenever we are defining a saperate proccesor we have to use "use"
NNeoBean7/27/2023
AGAyush Goyal8/8/2023
thank you

Looking for more? Join the community!

T
tRPC

what is "use" keyword

Join Server