← Back to context

Comment by gabes

1 hour ago

I think this misses what is undeniably the best part about zod. Yes, you could define all of your types this way, but it’s only necessary at the boundary of the program. Internal functions don’t need to validate inputs if the caller is trusted.

Being able to define a loose input schema at the boundary and then transform it into a shape that your program actually needs is extremely useful.