TanStackT
TanStack6mo ago
5 replies
slow-yellow

Typings on validation errors for fieldComponents

I'm trying to implement Zod in my Tanstack form, but I'm struggling to find a type safe way of presenting the errors from validation. My components are FieldComponents, and I want them to have their own error presentation but the type for field.form.state.errors is an any[] (pic 1). I'm a bit confused of what I need to do differently. If I try to access it from its executive parent then the type is undefined[] (pic 2). Any help would be greatly appreciated, and I can provide any further info that is needed. The full path works (pic 3), but I'd like to have it be properly typed.
Screenshot_2025-07-21_at_15.06.34.png
Screenshot_2025-07-21_at_15.11.54.png
Screenshot_2025-07-21_at_15.13.23.png
Was this page helpful?