react-accessible-dropdown-menu-hook
react-accessible-dropdown-menu-hook copied to clipboard
Export type definitions for button and item props
Hi,
Thanks for making this! I started using it in my app but wanted to wrap it to keep a consistent look and feel for menus in my app. However, I wanted to keep the interface flexible, so I'd like to just re-export parts of the underlying types in my wrapper component's props. I can't do that right now because those are not exported.
Thoughts on exporting the button and item prop types like this?
Hi @uhoh-itsmaciek , thanks for using our package and being open to making contributions. For this contribution, it seems like your use-case can be covered by the ReturnType utility type that Typescript provides. Something like ReturnType<typeof useDropdownMenu>
, I think that would probably satisfy any case where someone needed access to the return value type of the hook, what do you think?
Hi @uhoh-itsmaciek , thanks for using our package and being open to making contributions. For this contribution, it seems like your use-case can be covered by the ReturnType utility type that Typescript provides. Something like
ReturnType<typeof useDropdownMenu>
, I think that would probably satisfy any case where someone needed access to the return value type of the hook, what do you think?
After some review, after the introduction of generics which we plan to expand in the future, the solution I provided here is actually very obtuse.
Oh good point, I could work with ReturnType, yeah. I think it'd still be nice to have something more straightforward (especially if as you say this will get more complex with generics), but I think it's okay for now.
Codecov Report
Base: 98.07% // Head: 98.07% // No change to project coverage :thumbsup:
Coverage data is based on head (
47095e1
) compared to base (a4e57e8
). Patch has no changes to coverable lines.
Additional details and impacted files
@@ Coverage Diff @@
## master #296 +/- ##
=======================================
Coverage 98.07% 98.07%
=======================================
Files 1 1
Lines 104 104
Branches 33 33
=======================================
Hits 102 102
Misses 2 2
Impacted Files | Coverage Δ | |
---|---|---|
src/use-dropdown-menu.ts | 98.07% <ø> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.