react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

Allow to parametrize a bunch of event-related types with concrete HTMLElement

Open Andarist opened this issue 5 years ago • 1 comments

This change improves the interop with external code expecting concrete handlers etc. If a library expects FocusEvent<HTMLButtonElement> then it won't accept just FocusEvent<HTMLElement>. Without this change, one has to cast quite a lot of things instead of providing the appropriate generic parameter once.

I don't expect this PR to solve this particular problem entirely. Most probably more places will need adjusting in the future but those are the ones that I have found so far.

✅ Pull Request Checklist:

  • [ ] Included link to corresponding React Spectrum GitHub Issue.
  • [ ] Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • [x] Filled out test instructions.
  • [ ] Updated documentation (if it already exists for this component).
  • [ ] Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

yarn check-types

Andarist avatar Jul 28 '20 20:07 Andarist

Looks good. I'll need to investigate what's going on with the documentation generator.

devongovett avatar Jul 29 '20 02:07 devongovett