Description
Describe the bug
I'm wondering if this was a design decision (I've seen it in RHF), but I feel like it is still incorrectly typed somewhere. A Field's field.state.value will have whatever type the useForm hook is given for that field. This is often correct, but when a default value is not provided the field can actually be undefined
. This can be the cause behind components switching between controlled/uncontrolled or just general issues from having invalid types.
Your minimal, reproducible example
https://codesandbox.io/p/sandbox/tanstack-form-d2rpvg?file=%2Fsrc%2FApp.tsx%3A20%2C7
Steps to reproduce
Hover over field.state.value
Expected behavior
As a user, I expected TS values to be correct, but I'm seeing that this field has a value that is not correctly captured by the provided TS constraints.
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
- OS: windows
- Browser: chrome
TanStack Form adapter
react-form
TanStack Form version
v0.19.5
TypeScript version
v5
Additional context
No response