DEV Community

Discussion on: JavaScript schema library from the Future 🧬

Collapse
 
dhruvgarg79 profile image
Dhruv garg

what about comparison with typebox? It's also much faster than zod.

Collapse
 
dzakh profile image
Dmitry Zakharov

This is actually very good, and it's very mature. I actually had a misunderstanding about it being a worse version of Typia, but after double-checking the docs, I was really impressed by it.

In the benchmark, you can indeed see that it's fast moltar.github.io/typescript-runtim...

But there are some trade-offs that are solved in ReScript Schema:

  • Optimised check only supports validation, not parsing with data transformations
  • I find the DX of ReScript Schema to be more friendly for web developers. Also, reshaping and reversing are still unbeaten
  • The TypeBox packages size is huge, making it not the best fit for web development github.com/sinclairzx81/typebox?ta...

So, at the moment of writing the article I think ReScript Schema is a better library if you use it for Web, but for server-side TypeBox is more mature and provides more flexibility and features. Although there are still some features of ReScript Schema you might want to use, which are not a part of TypeBox 😉

ReScript Schema v10 is coming, which will improve the flexibility similar to TypeBox while boosting DX even more, exceeding Zod and ArkType levels 😁

Collapse
 
dzakh profile image
Dmitry Zakharov

Ok, I decided to double-check the package size table from their docs and it actually happened that the package size is not big bundlephobia.com/package/@sinclair...

Another thing to compare is the much more readable error messages by default in ReScript Schema.

Thread Thread
 
dhruvgarg79 profile image
Dhruv garg

I will give it a try in near future, thanks for amazing library my friend :)