Bug Fix: TypeScript migration for helpers.ts

オープン
#6,781 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Rohit3523 がすでに取り組んでいます。

2025年11月13日 から。

  • #6796 @DSingh0304 による — マージされずにクローズ

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
typescript

調査の方向性

app/lib/methods/helpers/helpers.ts から始めて、一覧にあるヘルパー関数を調べ、次に app/lib/hooks/useUserData.ts と app/containers/MessageComposer/components/ComposerInput.tsx での使用箇所を読んで、必要な型を判断します。@ts-nocheck を削除し、パラメーターと戻り値のアノテーションを追加しながら yarn lint と TypeScript コンパイラーを実行します。完了とは、ファイル全体がチェックされ、新しい型エラーがない状態を意味します。

索引モデルが issue の本文から書いたものです。

説明

🐛 bug
Describe the Bug

The file app/lib/methods/helpers/helpers.ts has @ts-nocheck at the top, which disables TypeScript checking for the entire file. All 8 exported functions lack proper TypeScript type annotations, reducing type safety and developer experience.

Steps to Reproduce
  1. Open app/lib/methods/helpers/helpers.ts
  2. Observe @ts-nocheck - TEMP comment at line 1
  3. Notice all function parameters lack type annotations (e.g., room, sender, item are untyped)
  4. Run yarn lint or TypeScript compiler - no type errors are reported for this file despite missing types
Expected Behavior
  • Remove @ts-nocheck directive
  • Add proper TypeScript types to all function parameters and return types
  • All functions should have complete type annotations
  • TypeScript compiler should properly check this file
Actual Behavior
  • TypeScript checking is disabled for the entire file
  • No type safety for 8 exported functions
  • Potential runtime errors that could be caught at compile time
  • Poor IDE autocomplete and IntelliSense support
Rocket.Chat Server Version

N/A (Code quality issue, not server-dependent)

Rocket.Chat App Version

4.67.0

Device Name

N/A (Code quality issue, not device-specific)

OS Version

N/A (Code quality issue, not OS-specific)

Additional Context

File: app/lib/methods/helpers/helpers.ts

Functions to migrate:

  • isGroupChat(room)
  • getRoomAvatar(room)
  • getUidDirectMessage(room)
  • getRoomTitle(room)
  • getSenderName(sender)
  • canAutoTranslate()
  • isRead(item)
  • hasRole(role)
  • hasPermission(permissions, rid?)

Impact: This file is used in multiple places:

  • app/lib/hooks/useUserData.ts
  • app/containers/MessageComposer/components/ComposerInput.tsx
  • And potentially other files

Related: Part of TypeScript migration effort to improve code quality and maintainability.

主要言語
TypeScript
スター
2.4k
フォーク
1.5k
平均マージ
1日 15時間
マージ済み PR(30日)
29

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

RocketChat/Rocket.Chat.ReactNative のほかの issue

RocketChat/Rocket.Chat.ReactNative の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。