-
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
fix: convert menubutton to typescript, and do other menu typescript cleanup. #15447
fix: convert menubutton to typescript, and do other menu typescript cleanup. #15447
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. |
✅ 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. |
@wkeese Hey Bill, is there a way you can take a look at these merge conflicts? Thank you! |
Looks like the conversion was already mainly handled by #15361 (cc @mattborghi). The main thing left in my PR is |
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.
@tay1orjones, @andreancardona - I fixed the merge conflicts. This is the second time it's happened, so hopefully this PR can be merged soon. The MenuButton conversion to Typescript changed the indentation, so git diff and git merge are useless. It doesn't even realize that index.tsx is just index.js renamed. Even though I used |
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.
We really appreciate all your work on this @wkeese! LGTM 👍🏻 ✅
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! 🚀
Thanks for the contribution!
00dc60f
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 whenx
andy
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 thePropTypes
declarations for reasons I don't understand. I'm not too worried about it sincePropTypes
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.