Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix submit func return type in typescript declaration #488

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chenesan
Copy link

@chenesan chenesan commented Dec 9, 2023

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
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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possibly wrong submit typescript type
1 participant