RocketChat / RocketChat/Rocket.Chat

ui-client: Refactor Callbacks utility for better type safety

Open
#38,827 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: feature
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.