react-spectrum
react-spectrum copied to clipboard
Allow to parametrize a bunch of event-related types with concrete HTMLElement
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
Looks good. I'll need to investigate what's going on with the documentation generator.