-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: convert menu, menubutton, and menuitem 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: There's some complication with MouseEventHandler vs. (evt: MouseEvent) => void being subtly different, which prevented me from adding types to internal methods. I don't understand the details. MouseEventHandler<HTMLLElement> is also subtly different from (evt: MouseEvent<HTMLLElement>, MouseEvent>) => void. 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. Speaking of which, this conversion required some guessing about types, in particular the types in MenuContext.ts.
- Loading branch information
Showing
6 changed files
with
394 additions
and
82 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.