form
form copied to clipboard
Type inference from serverValidate is misleading
Describe the bug
The type of the response from serverValidate (from a createServerValidate) in the example next server actions app has the age field as number, but if you access age at runtime it will be a string.
Your minimal, reproducible example
https://stackblitz.com/github/tanstack/form/tree/main/examples/react/next-server-actions?embed=1&theme=light&preset=node&file=src/index.tsx
Steps to reproduce
- Open stackblitz
- Check the type that ts expects for
validatedData:
- See at runtime that printed age is actually a string:
Expected behavior
I'd expect that the type of validatedData should be remain a FormData since it doesn't actually parse the fields into their typescript types.
Another option could be that all the fields of validatedData are strings?
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
macOS chrome 135
TanStack Form adapter
None
TanStack Form version
1.6.3
TypeScript version
5.8.2
Additional context
No response