Skip to content

Type input without using zod/validation? #978

Answered by KATT
sam3d asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, but you should really, really not do this

function passThroughAsNumber(input: unknown) {
  return input as number;
}
const router = trpc.router().query('num', {
  input: passThroughAsNumber,
  resolve({ input }) {
    return {
      input,
    };
  },
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sam3d
Comment options

Answer selected by KATT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #971 on September 20, 2021 19:41.