Skip to content

Refactor: Fix untyped array in MessageBox #39674

@Salvatoree07

Description

@Salvatoree07

[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[] => [];

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featurePull requests that introduces new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions