-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Do these types belong to HTMLAttributes? #4202
Description
- Check if updating to the latest Preact version resolves the issue
Describe the bug
Looking at these type declarations, I can see some attributes inside the HTMLAttributes interface that are commented as 'Standard HTML Attributes' but many of them aren't standard at all.
In my particular case I spent a lot of time trying to setup a type with Typescript that used HTMLAttributes for a couple of elements (HTMLInputElement and HTMLTextAreaElement) which discriminated attributes from one or another depending on a prop value. I was expecting the rows attribute to be present only on the HTMLTextAreaElement and not in the HTMLInputElement because rows is a native element of a textarea and not of an input. I assumed this and slammed my head onto a wall when I figured out that the attribute rows wasn't being discriminated because it was present as a 'standard' element in the general HTMLAttributes interface.
Is it intended to be like this because something that I am missing? (I am not very familiar with preact). Every other major framework (including React, Astro and Svelte) don't include this 'standard' attribute.
To Reproduce
I don't think an actual minimal repo isn't necessary in this case, but I have this example of the Typescript Playground which tries to grab the 'rows' attribute from an input element using both the react typings and the preact ones. While the preact ones are resolved, the react ones are not (as I would expect).
Expected behavior
The 'rows' key of the HTMLAttributes<HTMLInputElement> should not be resolved (how it happens with the react types).
