Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: menu typescript updates (#15447)
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.
- Loading branch information
Showing
6 changed files
with
365 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.