Indigo
Indigo4mo ago

How can you extract the mutation type signature?

Hi folks, this isn't a major issue and not blocking by any stretch. I was hoping to abstract my mutation callback so that I can keep my router relatively flat.
export const getUserAuthRouter = () =>
router({
googleAuthRedirect: publicProcedure
.input(z.object({ credential: z.string() }))
.mutation(googleAuthRedirectMutation),
});
export const getUserAuthRouter = () =>
router({
googleAuthRedirect: publicProcedure
.input(z.object({ credential: z.string() }))
.mutation(googleAuthRedirectMutation),
});
If I wanted to do something like this, is there a way to pull out the type signature for my callback? I tried importing a few things but they were all in a module explicitly labelled not to import from 😅 Thanks!
2 Replies
Alex / KATT 🐱
Define Procedures | tRPC
A procedure is a function which is exposed to the client, it can be one of:
Indigo
Indigo4mo ago
Ah you're a champ, thank you!