Describe the bug
When using TypeScript 5.8.2, there is an issue with typing the e.target.value in the onChange handler. It throws a type error of TS2339: Property value does not exist on type EventTarget & HTMLInputElement as seen in screenshot.
Reverting back to 5.6.3 removes this error.
Your minimal, reproducible example
https://stackblitz.com/github/tanstack/form/tree/main/examples/react/simple?embed=1&theme=light&preset=node&file=src/index.tsx
Steps to reproduce
- Clone any of the examples into an environment where the TypeScript version can be selected (StackBlitz doesn't seem to allow changing versions)
- Set IDE TypeScript version to 5.8.2
- Type error shows up on
e.target.value portion
Here is a simple snippet:
<form.Field
name="name"
validators={{
onChange: ({ value }) => (!value ? 'A name is required' : undefined),
}}
>
{(field) => (
<>
<label htmlFor={field.name}>Label Text</label>
<input
value={field.state.value}
name={field.name}
onBlur={field.handleBlur}
placeholder="placeholder"
className={error ? 'border-red-500' : ''}
onChange={(e) => field.handleChange(e.target.value)}
/>
<p>{field.state.meta.errors.length ? field.state.meta.errors.join(',') : '\u00A0'}</p>
</>
)}
</form.Field>
Expected behavior
No type error is present as value should be a valid property on HTMLInputElement
How often does this bug happen?
Every time
Screenshots or Videos
Platform
- OS: Mac
- Browser: Chrome (Arc)
- Version: 134
TanStack Form adapter
react-form
TanStack Form version
v1.1.0
TypeScript version
v5.8.2
Additional context
No response
Describe the bug
When using TypeScript 5.8.2, there is an issue with typing the
e.target.valuein the onChange handler. It throws a type error ofTS2339: Property value does not exist on type EventTarget & HTMLInputElementas seen in screenshot.Reverting back to 5.6.3 removes this error.
Your minimal, reproducible example
https://stackblitz.com/github/tanstack/form/tree/main/examples/react/simple?embed=1&theme=light&preset=node&file=src/index.tsx
Steps to reproduce
e.target.valueportionHere is a simple snippet:
Expected behavior
No type error is present as
valueshould be a valid property onHTMLInputElementHow often does this bug happen?
Every time
Screenshots or Videos
Platform
TanStack Form adapter
react-form
TanStack Form version
v1.1.0
TypeScript version
v5.8.2
Additional context
No response