DropdownDetails > DetailsProps not exported
Hi, I found that DetailsProps (which should be named DropdownDetailsProps I think) are not exported and I can't make the following code work:
<Dropdown.Details {...(props)} />
If I use DropdownProps I get the following error
@gvillo thanks for reporting this, I agree the name should be changed. However, it doesn't necessarily need to be exported, and that isn't the source of your error.
The error message is indicating that the event handler you're passing into the props is typed for a <div> rather than <details>. If you aren't manually typing this yourself, my best guess is you're destructuring props coming from somewhere else like a parent component which is causing the mismatch.
I was using DropdownProps because I wanted to have all the types from Dropdown (plus my types). I've tried to do make it work with Dropdown.Details, and that's the error that I am getting, because Dropdown uses div, and Dropdown.Details uses details, and there is no DropdownDetailsProps exported at all so I can make my own component that extends Dropdown.Details.
If I do what I am doing with Dropdown it works flawless, because I can declare
type CustomDropdownProps = DropdownProps & { variant: string }
const CustomDropdown: FC<CustomDropdownProps> = ({variant, ...props}) => {
const _className = 'blabla' // based variant apply classNames, etc etc
return (<Dropdown {...(props as DropdownProps)} className={_className} />)
}
I really think that this should be possible with Dropdown.Details, like it's possible to do it with just Dropdown.
Looking now and questionable design choices were made on the <Dropdown>. I'm going to reorganize things a bit to help with your issue.