chore: improved support for generics MenuItemType and MenuItemProps in the Menu component #42240
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
Fix: #36065
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
🤖 Generated by Copilot at 83dbe46
Refactored
Menu
andMenuItem
components to support custom menu item types and props as generic parameters. This allows users to create and use their own menu item types with additional props and callbacks.🔍 Walkthrough
🤖 Generated by Copilot at 83dbe46
ItemType
type alias to support custom menu item types using generic parameter and conditional type (link)ItemType
andMenuItemType
types fromuseItems
hook module toMenu
component module (link)CompoundedComponent
type alias to support custom props forMenu
component using generic parameter and custom type aliases (link)GenericComponent
interface to extendCompoundedComponent
type and override call signature to accept generic props (link)Menu
component toGenericComponent
type instead ofCompoundedComponent
type to export generic call signature and subcomponents (link)MenuItem
component to support custom props for different menu items using generic parameter and custom type alias (link)