GoogleFeud / ts-runtime-checks

A typescript transformer that automatically generates validation code from your types.
https://googlefeud.github.io/ts-runtime-checks/
MIT License
312 stars 7 forks source link

[Question]: Also not an issue, just stating that this is a brilliant idea! #55

Closed Odas0R closed 6 months ago

Odas0R commented 6 months ago

I'm currently using Zod in a web project, and I'm processing large amounts of datasets. Since performance is a bottleneck, this might be suitable.

Is this production, ready, or already being used in?

Giga :star: and follow

GoogleFeud commented 6 months ago

Hi, thank you so much for the support! This project would be nothing without you guys!

About whether it's production-ready or not - we have a good amount of unit and regression tests, however, they do not cover all possible cases, and I'll be updating them soon, but you shouldn't see any issues with most types. I'm not sure if anybody is using this library in production.

One thing you might encounter that looks like a bug is with union types - the transformer has trouble and most often generates invalid code for unions like Array<string> | Array<number> or { a: string } | { b: number }. I have plans to make unions of arrays work, but unions of plain objects most likely will never be supported. The transformer has great support for discriminated unions, though! They should be used whenever possible, unions of plain objects in general don't have that many use cases, here is an example

Odas0R commented 6 months ago

Thank you so much for the feature-wise write-up !

I'll give it a shot. My use cases are pretty simple, just database collections with lots of nested references.

Thank you for the tip regarding the type unions.