typescript error when flattenting a zoderror object
I have this code here. the error parameter after being passed to
treeifyError
would output value like this
I wanted to flatten it into something like this
but the typescript keeps complaining here and outputs a deeply nested type. Is there a way to make this easier to flatten?
1 Reply
by the way I did try flattenError method of zod but typescript marks it as deprecated
I think this is the return type of
treeifyError
method
is working with typescript always this complex or this is easy and I just don't know enough
Honestly this ternary operator usage is disgusting
this sorta works but i had to use assertation and object type