Skip to content

Conversation

@rschristian
Copy link
Member

Neither React nor Solid (if I've understood their types right, had to go looking for that and it's seemingly not in their org? weird) do this so I'm a tad apprehensive as otherwise seems like a pretty obvious DX improvement. Take the following example:

import type { JSX } from 'preact'; // Before interface MyInputProps extends JSX.InputHTMLAttributes<HTMLInputElement> { ... } // After interface MyInputProps extends JSX.InputHTMLAttributes { ... } interface MyWhackyInputProps extends JSX.InputHTMLAttributes<HTMLButtonElement> { ... }

Users can still supply the generic parameter if they wish but 99% of the time they're going to want the element associated with the attributes which we can simply assume as the default.

@coveralls
Copy link

coveralls commented Dec 12, 2024

Coverage Status

coverage: 99.615%. remained the same
when pulling 779f4a2 on refactor/default-element-targets
into 2beb9f7 on main.

@rschristian rschristian changed the title refactor: Assume default targets for HTML attribute interfaces refactor: Add default event target types for HTML attribute interfaces Dec 12, 2024
Copy link
Member

@JoviDeCroock JoviDeCroock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a no-brainer honestly, great DX win, just the tests and we are good

@rschristian rschristian merged commit 2b82799 into main Dec 15, 2024
5 checks passed
@rschristian rschristian deleted the refactor/default-element-targets branch December 15, 2024 17:37
@JoviDeCroock JoviDeCroock mentioned this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants