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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handleChange definition in FormState type definition is incorrect #140

Closed
letoast opened this issue Oct 27, 2021 · 6 comments · Fixed by #145
Closed

handleChange definition in FormState type definition is incorrect #140

letoast opened this issue Oct 27, 2021 · 6 comments · Fixed by #145
Labels
bug Something isn't working released

Comments

@letoast
Copy link

letoast commented Oct 27, 2021

inside /lib/index.d.ts:

type FormState<Inf = Record<string, any>> = {
  ...
  handleChange: () => void; <-------
  ...
};

which is incorrect, since the function's definition inside create-form.js is

 function handleChange(event) {
    const element = event.target;
    const field = element.name || element.id;
    const value = isCheckbox(element) ? element.checked : element.value;

    return updateValidateField(field, value);
  }

this produces an annoying warning if you try to pass an event to the function manually....

@letoast letoast added the bug Something isn't working label Oct 27, 2021
@tjinauyeung
Copy link
Owner

🎉 This issue has been resolved in version 1.10.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

@larrybotha
Copy link
Collaborator

@letoast thanks for raising the issue. Please check out v1.10.9 and let me know if you have any issues

@letoast
Copy link
Author

letoast commented Nov 7, 2021

@larrybotha
Haven't checked the update yet, but just by looking at the type definition, it still doesn't match the function definition.
As far as I know typescript, the type definition should be:

handleChange(event: Event) => any

That way, typescript shouldn't report that the function is expecting 0 arguments if you pass in an event when calling it.

@tjinauyeung
Copy link
Owner

🎉 This issue has been resolved in version 1.10.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

@larrybotha
Copy link
Collaborator

derp, you're right... I was being lazy and didn't evaluate the actual function thoroughly. Thanks @letoast - added the missing parameter to the function signature in #145

@letoast
Copy link
Author

letoast commented Nov 7, 2021

No probs, thank you for the fast update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants