I want to put this out for feedback from the community. This transformers issue has caused me a lot of grief and headaches but I’m confident in the new direction in fact I already have most of it working. In this scenario Zod 2 would never leave beta, we’d jump straight to v3. If/when I make these changes, I plan to publish them as Zod v3. I would still consider this to be a breaking change of course. Under the hood things would be working very differently but most projects could upgrade painlessly unless they explicitly use the ZodTransformer class in some way (which isn’t common). Then all the mods of A would be transferred over to the newly created schema This function would instantiate A.optional().mod(val => typeof val != "undefined" ? val : defaultValue). A.default(defaultValue): this is trickier but still possible.z.transformer(A, B, func): this could just return A.transform(func).refine(val => B.safeParse(val).success).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |