Field errors returned from onSubmitAsync aren't TS-checked
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.7k
- Forks
- 682
- Avg merge
- 5d 18h
- Merged PRs (30d)
- 7
Description
Describe the bug
Form's onSubmitAsync validator allows returning object like this:
return {
fields: {
field1: `Field1 has a problem`
}
}
Considering the strong type checks, I expected that if field1 didn't exist, Typscript would scream about this.
Your minimal, reproducible example
Steps to reproduce
The linked playground already contains the imho incorrect behavior.
Expected behavior
I expected Typescript error about the fields object containing unknown key.
How often does this bug happen?
None
Screenshots or Videos
No response
Platform
This is about Typescript, not code running in browser.
TanStack Form adapter
react-form
TanStack Form version
1.12.0
TypeScript version
5.8.3
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked TypeScript playground and the react-form adapter's onSubmitAsync typing. Reproduce the accepted unknown field key, then trace the relevant type definitions; done means TypeScript reports an error for fields that are not part of the form.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100