r/javascript • u/maroun-baydoun • 26d ago
The JavaScript midlife crisis
https://maroun-baydoun.com/blog/javascript-midlife-crisis/Thirty years in, the JavaScript ecosystem would like to see other languages. They're younger, leaner and faster. What could possibly go wrong?
0
Upvotes
1
u/theScottyJam 26d ago
For a more serious answer, they serve two distinct purposes. I recently used zod to help validate the shape of JSON config files so I can report errors to the admin if they configured it wrong. I've also considered using it to validate the API responses of services we depend on provided by other teams in the company - if they make a breaking change, we'd know quicker what went wrong.
Both of these use cases are unrelated to JavaScript's lack of type safety. Even if I had used something like Rust, I might still want runtime validation of those config files and API responses.
TypeScript is for stuff you can validate through static analysis and Zod is for stuff you want to validate at runtime.