RocketChat / RocketChat/Rocket.Chat
ui-client: Refactor Callbacks utility for better type safety
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
The Callbacks utility in ui-client uses loose generic constraints and any types, making it prone to errors and providing poor IDE support.
Proposed Improvement:
Introduce semantic types: EventLikeCallbackSignature (for side-effects) and ChainedCallbackSignature (for transformations).
Replace loose constraints with Record<string, Signature>.
Make the constant parameter optional in callback helpers.
Motivation:
Improves maintainability and prevents typing regressions in one of the core utilities of the UI.
Related PR:
#38627
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 with the Callbacks utility in ui-client and review the proposed changes described in related PR #38627. Confirm how the utility currently defines callback constraints and helpers, then verify that semantic signatures, Record<string, Signature> constraints, and optional constant parameters provide the intended type safety.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100