jaredpalmer / jaredpalmer/formik
onSubmit has incorrect return type
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 34.3k
- Forks
- 2.8k
- PR merge metrics
- No merged PRs in 30d
Description
🐛 Bug report
Current Behavior
onSubmit: (values: Values, formikHelpers: FormikHelpers<Values>) => void;
Expected behavior
onSubmit: (values: Values, formikHelpers: FormikHelpers<Values>) => Promise<unknown>;
This is unrelated to the current push to de-promisify the onSubmit behavior introduced in v2, but is related to #1875 (documentation).
I want to chime in that I actually like the change to Promise<> – I had to write an adapter for my current project so that we could do the same thing, and then I saw it got landed into v2. (I also forgot to handle the case when the component has unmounted in the then handler, and wrote code for that case in the very same way that Formik does.)
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 by locating the TypeScript declaration for the onSubmit signature shown in the issue. Compare it with the expected Promise signature, then verify that the resulting type-checking behavior matches the issue's expected declaration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100