Closed longnguyen2004 closed 1 year ago
Those rest props should match the props that the base HTML element of the component can receive. In the case you mention, the type of Menu.Item is buggy, it should extend the HTMLButtonElement and not HTMLElement. Nice catch, this one definitely needs a fix.
Can you give examples of other components? It might be the same problem of using the wrong HTML element
Maybe those other components that I've pointed out don't need extra props, but if I want Menu.Item
to be an anchor, I can't put href
on there because there's no corresponding property in the type. Changing it to inherit HTMLButtonElement
doesn't work either, as it essentially forces Menu.Item
to be a button, which is not what I want.
It's already a button by default (check prop root
). I've made a commit with a fix for this particular problem. Do you know of other cases where this happens?
Menu.Item
is the first thing that comes up to me, the others are probably fine, since you're not expected to change the root of them anyway.
Should be fixed then 👍 I'll probably release a patch this week
What package has an issue
@svelteuidev/core
A clear and concise description of what the bug is
I've noticed that many components are using
$$restProps
but doesn't have[x: string]: unknown
in their prop type, which causes TypeScript to error out. I haven't checked all the components, butMenu.Item
is one of them, and probably every component in this commit as well. I can make a PR that adds them in if you approve.In which browser(s) did the problem occur?
No response
Steps To Reproduce
Use
MenuItem
, which is aBox
under the hood, and pass in something likehref
Do you know how to fix the issue
Yes
Are you willing to participate in fixing this issue and create a pull request with the fix
Yes
Relevant Assets