RocketChat / RocketChat/Rocket.Chat
Refactor: Fix untyped array in MessageBox
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
[Refactor] Fix untyped array in MessageBox.tsx:76
Description
In apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx at line 76, there is a generic untyped array (any[]). This practice leads to type inference failure when the array is passed as a prop, causing a loss of type safety and information throughout the component.
Bug / Issue Details
- Rocket.Chat version: Latest / Develop
- Target File:
apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx(lines 76-77)
Expected behavior
The code should use strict typing to ensure that the IDE and the TypeScript compiler can correctly infer types, avoiding the "leakage" of any into other parts of the frontend.
Actual behavior
The current implementation uses a shortcut that bypasses linting but compromises type safety:
const a: any[] = [];
const getEmptyArray = () => a;
Proposed Solution
Replace the untyped array with a strictly typed empty array or a typed function return.
const getEmptyArray = (): never[] => [];
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 in apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx at lines 76-77 and inspect how getEmptyArray is passed as a prop. Replace the untyped array with an explicit type, then run the relevant frontend TypeScript and lint checks. Done means the any[] usage is removed without type errors or loss of type safety.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100