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

[BUG] - Checkbox onChange Incorrect Type #1380

Closed
aaronhawkey opened this issue Aug 12, 2023 · 0 comments · Fixed by #1381 or #1383
Closed

[BUG] - Checkbox onChange Incorrect Type #1380

aaronhawkey opened this issue Aug 12, 2023 · 0 comments · Fixed by #1381 or #1383
Labels
🐛 Type: Bug Something isn't working

Comments

@aaronhawkey
Copy link

Describe the bug

onChange on CheckBox is expecting FormEventHandler<HTMLLabelElement>. It should be expecting React.ChangeEvent<HTMLInputElement>

Type '(e: React.ChangeEvent<HTMLInputElement>) => void' is not assignable to type 'FormEventHandler<HTMLLabelElement>'. Types of parameters 'e' and 'event' are incompatible. Type 'FormEvent<HTMLLabelElement>' is not assignable to type 'ChangeEvent<HTMLInputElement>'. Types of property 'target' are incompatible. Type 'EventTarget' is not assignable to type 'EventTarget & HTMLInputElement'. Type 'EventTarget' is missing the following properties from type 'HTMLInputElement': accept, align, alt, autocomplete, and 339 more.

Your Example Website or App

https://codesandbox.io/p/sandbox/compassionate-mcnulty-ncf6wm

Steps to Reproduce the Bug or Issue

  1. Use typescript based react
  2. Implement a checkbox.
  3. Create an onChange method that takes in React.ChangeEvent as input
  4. Apply method to onChange.

Expected behavior

It should be expecting React.ChangeEvent<HTMLInputElement>.
https://nextui.org/docs/components/checkbox#checkbox-events

Screenshots or Videos

Image

Operating System Version

MacOS & Linux

Browser

Chrome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Type: Bug Something isn't working
Projects
None yet
1 participant