Live data from Hacker News

Zod v4 Beta

v4.zod.dev

21–30 of 48 posts

Re: Zod v4 Beta

#21
I've created some crazy types with zod since v3 released, these look like really interesting changes for v4.

I've been bit by performance issues, and even a few issues where I just couldn't infer types, with some of the more complex schemas I tried to define, especially with multiple .extend() and .omit() calls.

The zod-mini library looks particularly interesting. I don't mind the more functional approach with nested functions rather than chaining. Reminds me of ramda, that library is pretty massive but still easy to tree shake since everything is functional.

Re: Zod v4 Beta

#24
post #17

We stuck with Yup and ignored Joi, Zod and god knows what else has come down the pipeline since. Rather than wasting time upgrading, we've instead built useful features. That said, we are slowly phasing out our React frontend for one of our apps page by page and replacing it with what we use over the rest of apps: Phoenix + Liveview. The changeset system for validations has proven itself time and time again to both b…

We’ve been using LiveView for years now and I still really miss the ergonomics that you get with typescript. A lot of that is going away with better LSP support and better LLM suggestions. But elixir and LiveView are generally great (I LOVE ecto), but building component frameworks and component communication still feels a bit janky.

I've used LiveView a little in the past, and besides the lack of static typing (at the time, I think Elixir has gotten some type annotations since), I really liked it and found it easy to work with.

Ecto though, I could never figure out how to use. If I could just make SQL queries in an ORM-style I would understand it, but the repositories and auto generated relations and such I couldn't figure out. Do you have any good resources for learning ecto? I didn't find the official docs helpful.

Re: Zod v4 Beta

#25
post #15
post #8

> Zod v3.0 was released in May 2021... v3 didn't last four years. Can we expect much different from v4? If you're migrating your zod 3 code, I'd migrate to something more stable and long-lived than v4 is likely to be -- unless you want to be going through it all again in a few years (and yet again a few years after that, etc). I don't blame the maintainers (I assume they don't have a fat support and maintenance contr…

This is a little disingenuous. As far as I know, v3 isn't going anywhere. There's what... weeks until May 2025, which would be four years? 4 years in JavaScript land is actually pretty long. Zod has a pretty good maintenance record. I don't see how a statement like yours can be made without snark. Calling it a "throw-away" library is pretty brash. This looks like a good update that sticks to the formula.

> 4 years in JavaScript land is actually pretty long

For non-JS developers to get a sense of how long this is, companies have probably migrated from React to Vue to Svelte to Solid and then back to React in this time.

Re: Zod v4 Beta

#26
post #15

Earlier quoted context omitted.

This is a little disingenuous. As far as I know, v3 isn't going anywhere. There's what... weeks until May 2025, which would be four years? 4 years in JavaScript land is actually pretty long. Zod has a pretty good maintenance record. I don't see how a statement like yours can be made without snark. Calling it a "throw-away" library is pretty brash. This looks like a good update that sticks to the formula.

> 4 years in JavaScript land is actually pretty long For non-JS developers to get a sense of how long this is, companies have probably migrated from React to Vue to Svelte to Solid and then back to React in this time.

Did they get any useful work done in that time, or just learn new frameworks? That sounds like a form of hell.

Re: Zod v4 Beta

#27
post #26

Earlier quoted context omitted.

> 4 years in JavaScript land is actually pretty long For non-JS developers to get a sense of how long this is, companies have probably migrated from React to Vue to Svelte to Solid and then back to React in this time.

Did they get any useful work done in that time, or just learn new frameworks? That sounds like a form of hell.

Of course, they upgraded from React v17 to v19!

Re: Zod v4 Beta

#28
post #7

I've really enjoyed typebox. Any reason to check out zod v4?

Definitely a little more ergonomic than type box, imo, but at the end of the day they’re very similar. I use typebox mostly because there is terrible zod support for Fastify. Both are great libs!

Re: Zod v4 Beta

#29
I completely understand TypeScript, Zod not so much. The context here is performance.

My understanding is that Zod performs synchronous operations to validate the schemas. Something about "using the tool correctly" resonates here. Maybe don’t validate very large and nested schemas frequently and things like that.

But I can’t help but think it is adding another layer of potential footguns that you have to be mindful about. Maybe the benefits outshine the risks in disciplined teams that understand both the tool and the runtime. However I can’t help but think about the less disciplined teams abusing Zod and then wondering why things are slow.

Re: Zod v4 Beta

#30
post #17

We stuck with Yup and ignored Joi, Zod and god knows what else has come down the pipeline since. Rather than wasting time upgrading, we've instead built useful features. That said, we are slowly phasing out our React frontend for one of our apps page by page and replacing it with what we use over the rest of apps: Phoenix + Liveview. The changeset system for validations has proven itself time and time again to both b…

We’ve been using LiveView for years now and I still really miss the ergonomics that you get with typescript. A lot of that is going away with better LSP support and better LLM suggestions. But elixir and LiveView are generally great (I LOVE ecto), but building component frameworks and component communication still feels a bit janky.

I love using Elixir on the backend, and I tried really, really hard to get LiveView, but it was just too hard of a paradigm shift for me to manage more complex state, plus too hard to walk away from my productivity with React. For example, something as simple as having inline edit on a list of widgets is super easy in React, but I found it _very_ challenging to do with LiveView, as you try and implement more features such as only editing one item at a time, etc.

I've actually found a bit of a resurgence in productivity with React on the front-end and Elixir/Absinthe/Ash Framework on the backend. With GraphQL I get fully typed queries, and Ash Framework on the Elixir side helps a ton with removing the boiler plate of code required for GraphQL, since Ash (mostly) generates the schema for me. A bit of a learning curve with Ash, but now that it's clicked, I feel more productive than I did with just Ecto/Contexts/LiveView.

https://www.ash-hq.org - there's a recent PragProg book on it that really helped it click for me.

Post reply on HN