Skip to content

Conversation

@honeymaro
Copy link
Contributor

Hey @typicode, Your big fan is back.

I'm really enjoying using this library, but I found one (maybe more) problem.

When I use 'input' element, MistCSS generates the interface like this:

interface Mist_input extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLInputElement>, HTMLInputElement> {
  ...
}

And this gives me an error:
image

Perhaps the correct interface would be:

interface Mist_input extends React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
  ...
}

I was trying to make a dictionary like src/html.ts but I found a more efficient way.

In this PR, I would like to introduce a new generic type utility that derives the JSX interfaces from the user's environment, freeing you from the hassle of constantly updating your library when new elements are added to HTML, or when there are changes to React. (And it also prevents unexpected problems... maybe...)

If you do not like the change, feel free to drop this PR, but anyway, I think the problem written above should be solved.

Thank you for reading my PR, have a nice day.

- Added `ReactHTMLProps` utility type to dynamically handle React HTML element type definitions.
- Fixed incorrect type generation for some elements (e.g., `input`), ensuring appropriate attribute types are used.
@typicode
Copy link
Owner

typicode commented Dec 5, 2024

Hey @honeymaro

Great PR, it simplifies things. Thanks!

@typicode typicode merged commit 1072bc6 into typicode:main Dec 5, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants