Everyone's talking about Valibot

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up Wizards this is a clip from a recent live stream where I talked about valibot which is a brand new uh kind of competitor design that just released a few days ago enjoy okay let's talk about volleyball um valebot is basically it looks like a competitor to Zod it's been created by this guy I think who's still maybe in college or university or something but it's been created kind of as his thesis essentially he's come up with this Library the idea of it is that it's basically likes odd like yup like type box fully type safe with static type inference small bundle size starting at less than 300 bytes validate everything right and it's gives you basically an API like this which is you import all of the pieces from valibots here and then you construct these schemas if you've used Zod before then like this is like exactly the same as Zod and it also gives you this output type where you can pass the thing in and you get a type and it also exports this pass function right too this pass function means you can pass take a login schema and then just return all the stuff now how can this be possible how can it be only 300 bytes here let's actually take a look at like bundle phobia and let's just see how it handles value bot and how it handles odd two really this is the number that you want to be paying attention to when it's minified and g-zipped this is like in total right this and with Zod because of the way it's structured basically everything comes off this kind of Z dot object whereas in value Bots you actually kind of import the stuff separately so you have instead of Z dot email you have email Min length object pass string Resort is basically all sort of attached to the same object which means it's hard to bundle split here it's hard to tree Shake whereas valibots if we take a look you can see actually it's only about sort of half the size is when it's minified in gzip so where are they getting this idea of the 300 bytes from well the idea is that you can basically it's much easier to tree Shake very very simple for things to understand okay email is separate from object which is separate to Min length and with Zod if you use kind of like dot Min or something it's going to be grabbing that pulling it into your project even if you're not using it whereas here the idea is you only take what you need yeah here we go so this is like this can reduce the bundle size by up to 98 compared to Zod and there we go my friend Fabian created me as part of his Bachelor thesis at Stuttgart media University and supervised by mishko heavy and Ryan canniato pretty decently uh weighty figures misco is obviously the guy who invented angular rankingato the guy who invented solid.js is it you're incomplete I don't know I don't know about tearing complete it's pretty badass though yeah if we're talking about performance I'm not sure how this Stacks up in terms of performance and performance is always a bit of a moving Target anyway right like all sorts of stuff is going to change the performance of how things handle and often doing benchmarks here is like I'm not sure whether you can trust a sort of tight box versus the up versus whatever Benchmark because it depends what features of the library you're using it depends on the execution environment I don't know really like this performance stuff it doesn't really yeah it just depends like massively on the exactly and performance is too contextual to be a firm metric the syntax is really really really similar to Zod and he literally says my role models also include Conor McDonnell which is a nice role model to have a lovely lovely dude who has a big influence on his API design with Zod so this is something that's trying to compete with Zod it's offering a very similar API to Zod it's saying that its bundle size is much smaller than Zod I haven't tested it out but I'm sure it works similarly to Zod I mean it's extremely cool thing I'm like really glad it exists and I think that having competition in this space is really really important and undercutting Zod on bundle size I think is a smart thing to do I would say though I bloody love that on with Zodi you get like the Z dot object Z dot this the chaining in the Builder pattern is just really beautiful to use because you can just auto complete your way to the right type and you get to explore the API a lot better whereas with volleyball you might be kind of importing the wrong things or TR you might actually get a bit more friction there when you're using it so I'm really Keen to see what the DX is like from that sort of perspective too yeah would I use it I mean this is to be determined absolutely
Info
Channel: Matt Pocock
Views: 36,718
Rating: undefined out of 5
Keywords: typescript, web development, advanced typescript
Id: 795SKl70JK8
Channel Id: undefined
Length: 4min 41sec (281 seconds)
Published: Fri Aug 04 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.