RocketChat / RocketChat/Rocket.Chat

Apps-Engine: Improve type safety for custom fields using JsonValue

Open
#38,747 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
Currently, the addCustomField, setCustomFields, and getCustomFields methods in the Apps-Engine use generic any or object types. This leads to poor type safety and potential runtime issues when handling custom data.

Proposed Improvement
Replace any/object with a recursive JsonValue type across all interfaces and implementations (Builders and Extenders) for:

IMessageBuilder / IMessageExtender

IRoomBuilder / IRoomExtender

Motivation
Better DX: Developers get better IDE auto-completion.

Validation: Prevents non-JSON compatible values from being passed to custom fields.

Consistency: Aligns the Apps-Engine with modern TypeScript standards used in the rest of the Rocket.Chat codebase.

Related PR
This issue is addressed by PR #38569.

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 by reviewing related PR #38569, then locate the Apps-Engine definitions and implementations for IMessageBuilder/IMessageExtender and IRoomBuilder/IRoomExtender. Confirm that addCustomField, setCustomFields, and getCustomFields consistently use a recursive JsonValue type instead of any or object across Builders and Extenders, with TypeScript validation passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
developer-experience
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.