You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Without type casting the default values, the form type gets inferred as ReactFormExtendedApi<TYPE, Validator<unknown, z.ZodType<any, z.ZodTypeDef, any>>> where TYPE is the type of object passed to default values instead of it being the type inferred from the zod schema.
Try removing the as User in line 35 in index.tsx file and see how the type of the form changes when you add/remove/modify any of the fields in the default values.
Expected behavior
Expected the form type to be inferred from the zod schema passed, as well as have type safety in default values without needing to manually cast the type.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
OS: Windows 11
Browser: Chrome
Version: 130.0.6723.71 (Official Build) (64-bit)
TanStack Form adapter
react-form
TanStack Form version
0.40.0
TypeScript version
5.6.3
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
Without type casting the default values, the form type gets inferred as
ReactFormExtendedApi<TYPE, Validator<unknown, z.ZodType<any, z.ZodTypeDef, any>>>
whereTYPE
is the type of object passed to default values instead of it being the type inferred from the zod schema.Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-form-9w9uhn8b?file=src%2Findex.tsx
Steps to reproduce
Try removing the
as User
in line 35 inindex.tsx
file and see how the type of the form changes when you add/remove/modify any of the fields in the default values.Expected behavior
Expected the form type to be inferred from the zod schema passed, as well as have type safety in default values without needing to manually cast the type.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
OS: Windows 11
Browser: Chrome
Version: 130.0.6723.71 (Official Build) (64-bit)
TanStack Form adapter
react-form
TanStack Form version
0.40.0
TypeScript version
5.6.3
Additional context
No response
The text was updated successfully, but these errors were encountered: