jaredpalmer / jaredpalmer/formik

onSubmit has incorrect return type

Open
#2,005 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.