Skip to content
Discussion options

You must be logged in to vote

Hi @codayon! I'm Dosu and I’m helping the zod team.

This is expected in Zod v4: the chainable .email() method on z.string() is deprecated and will show a warning, while the top-level z.email() function is the new, preferred way to validate emails and does not show a deprecation warning. This change was made because string format validations like email, uuid, etc., are now represented as specialized subclasses (like ZodEmail) and exposed as top-level factory functions for better tree-shaking and API clarity. The old method form (z.string().email()) still works but is marked as deprecated in TypeScript/JSDoc to encourage migration to the new API (changelog, docs).

If you want to combine st…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by codayon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant