-
In some generated code the following schema is used to validate some query input:
Can someone explain to me why |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Good question. On the frontend, result of |
Beta Was this translation helpful? Give feedback.
Good question.
On the frontend, result of
useParam
type isnumber | undefined
. So somehow we need to get thenumber | undefined
type to work with the query input. One way is by marking the zod schema as optional. The other way, is keep zod schema as justz.number()
and on the frontend have the query input as{id: userId!}
. The!
character will override the TS type to remove| undefined