Skip to content

Confusing terms - parse vs validate #962

Answered by scotttrinh
MartinMuzatko asked this question in Q&A
Discussion options

You must be logged in to vote

@MartinMuzatko

Thanks for your feedback here. The following thoughts are my own, but they are the reason I became involved with the Zod project, so hopefully I can provide some context here.

The difference between parsing and validating in this context is that the function returns the data rather than asserting anything about the input data directly. That's the reason we don't have type guards or assertion functions, for instance. Since running the schema's checker on the value doesn't tell TypeScript anything about the input data, I feel like parse is still the more semantically correct name for what Zod is doing.

If zod were a parser, it could help me to transform data e.g. retrieved b…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by JacobWeisenburger
Comment options

You must be logged in to vote
0 replies
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 #921 on February 23, 2022 14:39.