Skip to content

Menu: fix TypeScript error#759

Open
mkernohanbc wants to merge 1 commit into
mainfrom
bugfix/menu
Open

Menu: fix TypeScript error#759
mkernohanbc wants to merge 1 commit into
mainfrom
bugfix/menu

Conversation

@mkernohanbc

Copy link
Copy Markdown
Contributor

This PR fixes a TypeScript error in the Menu component. Previously, there was an inconsistency in how the items prop (used to pass an array of menu items) was typed in the MenuSectionProps and MenuProps interfaces. In MenuProps it was typed as items?: T[], which caused an incompatibility error with the onAction callback.

With this change, items is now typed consistently as items: MenuItemProps[] in both contexts. This resolves the error, and is consistent with how we've approached this same functionality in Select.

@mkernohanbc mkernohanbc added this to the Components v0.9.0 milestone Jun 25, 2026
@mkernohanbc mkernohanbc self-assigned this Jun 25, 2026
@mkernohanbc mkernohanbc requested a review from a team as a code owner June 25, 2026 20:18
@mkernohanbc mkernohanbc added react-components Changes or issues affecting the design-system-react-components package bug labels Jun 25, 2026
@ty2k ty2k requested review from Copilot and ty2k June 26, 2026 22:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Menu component’s TypeScript types to resolve an incompatibility stemming from inconsistent items typing between MenuSectionProps and MenuProps, aligning MenuProps.items to use MenuItemProps[].

Changes:

  • Remove the generic type parameter from MenuProps and the Menu component signature.
  • Type MenuProps as ReactAriaMenuProps<MenuItemProps> and items?: MenuItemProps[] to match MenuSectionProps.items.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +28 to +32
export interface MenuProps extends ReactAriaMenuProps<MenuItemProps> {
/* Set size of menu items (does not affect the MenuTrigger element) */
itemSize?: "small" | "medium";
/* Use for a simple list menu */
items?: T[];
items?: MenuItemProps[];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug react-components Changes or issues affecting the design-system-react-components package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants