RocketChat / RocketChat/Rocket.Chat
GenericMenu: Improve type safety by removing unsafe casts
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
The GenericMenu component currently uses an unsafe as any cast when cloning the button prop, and the button prop itself lacks a specific React type.
Proposed Improvement:
Add explicit ReactElement type to the button prop in GenericMenuCommonProps.
Remove the as any assertion in cloneElement.
Motivation:
This improves the overall type safety of the ui-client package and provides a better developer experience without changing runtime behavior.
Related PR:
#38594
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating GenericMenu and GenericMenuCommonProps in the ui-client package, then inspect the button prop and the cloneElement call; review related PR #38594 for context. Done means the button prop has an explicit ReactElement type, the unsafe as any assertion is removed, and the package's type checks pass without runtime changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100