6 Replies
@Scott Trinh I basically want to create class instances from schema's, but not sure if it is any good to do.
Oh, I think I understand. Yeah nothing built in but you can certainly use Zod in your constructor to do a lot of what you would normally do in a constructor.
@Scott Trinh There is something built-in 🙂
.transform
does it with easeHmm, maybe I'm just not understanding the question after all, but glad that works!
Yeah so I m basically building up a class instance using transform
Ahh, gotcha. I was thinking the other way around like:
Basically "hide" Zod within the constructor so the consumer doesn't need to think about the parsing, but that definitely has a different public type interface (
unknown
vs. string
).