Skip to content

Fix submit func return type in typescript declaration#488

Closed
chenesan wants to merge 1 commit into
final-form:mainfrom
chenesan:fix-submit-typescript-type
Closed

Fix submit func return type in typescript declaration#488
chenesan wants to merge 1 commit into
final-form:mainfrom
chenesan:fix-submit-typescript-type

Conversation

@chenesan

@chenesan chenesan commented Dec 9, 2023

Copy link
Copy Markdown

This PR resolves #368.

Currently this issue will cause all typescript users cannot rely on the type declaration of FormApi['submit']. The return type of FormApi['submit'] is wrong: When submit is async, the value of Promise should be SubmissionErrors | undefined, not FormValues | undefined.

Personally I found this error when I try to apply typescript in a project using final-form, and found out this brings a lot of tsc errors in codebase, which relies on returned submission errors heavily. Had to patch the fix in my project temporarily but not ideal.

@erikras it would be great if you could take a look for this one-line patch 🙏

Also thanks @akozhemiakin raising #368 and suggest the fix 👍

@chenesan
chenesan marked this pull request as ready for review December 9, 2023 08:45
@chenesan

Copy link
Copy Markdown
Author

Hi @gertdreyer sorry for pinging 😅 I'm not sure currently who is responsible for maintaining this project and just found out you're the recent reviewer of PRs like #473. Would you mind reviewing this pr?

@erikras erikras closed this in #499 Jun 8, 2025
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possibly wrong submit typescript type

1 participant