Designing the perfect TypeScript schema validation library
1–10 of 77 posts
Re: Designing the perfect TypeScript schema validation library
#2Edit: Found it: https://github.com/vriad/zod
Re: Designing the perfect TypeScript schema validation library
#3Re: Designing the perfect TypeScript schema validation library
#4Can't seem to spot a link to Zod's code Colin. Fancy making it a bit more obvious in the post? Edit: Found it: https://github.com/vriad/zod
Re: Designing the perfect TypeScript schema validation library
#5Worth noting, another option is Runtypes[1], which also looks great. I can't remember off the top of my head why I ultimately picked io-ts over Runtypes, but it's another one for folks to consider (and I'd be curious what the Zod author thinks of it).
Re: Designing the perfect TypeScript schema validation library
#6Re: Designing the perfect TypeScript schema validation library
#7This is great. I recently built a fairly large amount of functionality around io-ts, adding support for mixed required/optional fields, eliminating the need to deal with `Either` monads, and a whole lot of other stuff that's mostly just relevant to my company's usage. I think if this had been available at the time I was looking for an underlying library, it would have been a no brainer to choose this one. Worth notin…
Re: Designing the perfect TypeScript schema validation library
#8 const dogsList = z.array(dogSchema);
dogSchema.parse([
{ name: 'Cujo', neutered: null },
{ name: 'Fido', age: 4, neutered: true },
]); // passes
Since 'Cujo' doesn't have an age? Assuming it's the same dogSchema as in the previous block, age is required, right?Oh, and a minor typo: This lets you confidently This way you can confidently....
Re: Designing the perfect TypeScript schema validation library
#9Looks useful - I would have an easier time introducing this than io-ts.