-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: Add Menu/MenuItem types #15361
Refactor: Add Menu/MenuItem types #15361
Conversation
✅ Deploy Preview for v11-carbon-react ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than one small comment - looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 ✅
fdce3b6
Hey there! v11.48.0 was just released that references this issue/PR. |
This builds on #15361 to do a few more menu-related Typescript updates: * MenuButton: Convert to Typescript. * MenuContext: Specify type for context. There’s contradictory evidence though about whether payload is mandatory or optional. * Menu: Minor cleanup including specifying that when x and y are arrays, the arrays contain exactly two numbers. * MenuItem: Convert some “any” types into actual types, including converting MenuItemRadioGroup to a generic. Also the same cleanup as above about x and y as arrays. Ignore spacing diffs. * useAttachedMenu() - Convert to Typescript. I had to add @ts-ignore to some of the PropTypes declarations for reasons I don't understand. I'm not too worried about it since PropTypes declarations are essentially deprecated. Also, I know the doc said not to convert internal files to Typescript but it didn’t seem feasible to do this conversion without useAttachedMenu.js and MenuContext.ts having the right types, and it didn’t seem feasible for them to have the right types without converting them to Typescript. Menu, MenuButton and MenuItem were left out of the list on #12513 but I assume they should be updated too. Actually, I need MenuButton and MenuItem to be updated before I can upgrade to Carbon 11. Other notes: I had to add @ts-ignore to the PropTypes declarations for reasons I don't understand. I'm not too worried about it since PropTypes declarations are essentially deprecated. Also, I know the doc said not to convert internal files to Typescript but it didn’t seem feasible to do this conversion without useAttachedMenu.js and MenuContext.ts having the right types, and it didn’t seem feasible for them to have the right types without converting them to Typescript.
Closes #15177
Add Typescript types for Menu and MenuItem.
Changelog
New
Changed
.js
to.tsx
/.ts
.Removed
Testing / Reviewing