Replies: 1 comment 8 replies
-
Not a bad idea...I'll need to think more about this. Currently you'd have to do this check as a refinement first, then transform it once you're confident that the data is valid. z.string().refine(s => !!fileModes.get(s), { message: "Invalid file mode" }).transform(s => {
const i = fileModes.get(s);
return {pass: true, value: i};
}), |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a transformation step that might also raise an error. For example, something like this:
Is there a good way to express that in Zod?
Beta Was this translation helpful? Give feedback.
All reactions