-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
types: Move per-element type interfaces into core and more strictly type IntrinsicElements #4546
types: Move per-element type interfaces into core and more strictly type IntrinsicElements #4546
Conversation
94fdf20
to
0e8bee0
Compare
868e5a4
to
a450a2f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WOW, this is amazing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
@rschristian Nice, I have updated the table to include the new types |
Awesome, thanks! Jovi & I were both looking at that, will take another look soon-ish to see which types we're missing (that we do support). |
Closes #4544 and #4202
Someone kindly contributed type interfaces for most elements to compat, so this PR takes those, moves them into core, and alters
IntrinsicElements
to use those more specific interfaces rather than the massive & genericHTMLAttributes
that we used to have. That interface still exists, however, it's been renamed toAllHTMLAttributes
, matching React. The newHTMLAttributes
is strictly limited to global attributes/props, only the things that are valid & make sense everywhere.As such, with this PR
<div src="/foo.jpg">
will now correctly result in a type error. I'm slightly concerned about breakages because of this but I think it's an unavoidable bandaid we'll have to rip off at some point.This is a fairly big change and I expect we will have some issues raised. There's 240 or so attributes now spread across a couple dozen interfaces. I've done my best to ensure this is correct but there's a lot of surface area here.