valibot: Type instantiation is excessively deep and possibly infinite.
Hello and first of all, thank you for your work with this library.
I was eager to migrate from zod
to valibot
after encountering this error on the use of schemas with many union
and transform
but the same one seems to occur.
Is there maybe a good practice to avoid it?
Thank you
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (11 by maintainers)
The way it was resolved in kysely:
It should be related to :
Thank you for the tip. I will try to investigate this in the next few weeks.
I am toying with the idea of removing
merge
because of this TypeScript problem. Meanwhile, Valibot has a workaround that accomplishes exactly the same thing with a good DX. Please give me feedback.Here is a guide that help to choose between
intersect
andmerge
: https://valibot.dev/guides/intersections/Yes, that works too. Thank you! Another workaround that works in most cases is
intersection
:Can you send me some code examples?