Validation error type safety when using form composition
Is there any way to pass a type down for validation errors when using form composition? Looks like it comes back as
any through useFieldContext, but for instance I know I'll always use Zod and so it should always be a ZodError in my case3 Replies
like-gold•2w ago
when using field context, the error can actually be anything.
If you want to pass it in a type safe way, pass it as prop from the field callback from
<form.AppField>foreign-sapphireOP•2w ago
I get what you're saying; I'll be sacrificing type safety instead, because I don't want to pass it in for every field
I'm just going to use
as in my custom components, I just thought maybe one of the generics was it and I just didn't know how to pass it in halike-gold•2w ago
unless you need zod-specific properties, you can narrow it with a small function just fine