RocketChat / RocketChat/Rocket.Chat

Unsafe `as any` type assertion in CurrentChatTags component

Open
#38,692 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Issue Description

The CurrentChatTags component in apps/meteor/client/views/omnichannel/additionalForms/CurrentChatTags.tsx uses an unsafe as any type assertion with a FIXME comment:

onChange={handler as any} // FIXME: any


Root Cause

The component defines its handler prop type as handler: (value: { label: string; value: string }[]) => void, but AutoCompleteTagsMultiple (which wraps PaginatedMultiSelectFiltered) expects onChange: (values: PaginatedMultiSelectOption[]) => void, where PaginatedMultiSelectOption = { value: string | number; label: string }.

The mismatch is value: string vs value: string | number, which caused the need for the unsafe as any cast.


Expected Behavior

The component should use PaginatedMultiSelectOption from @rocket.chat/fuselage directly, eliminating the type mismatch and removing the need for an unsafe cast.


Affected Files

  • apps/meteor/client/views/omnichannel/additionalForms/CurrentChatTags.tsx
  • apps/meteor/client/views/omnichannel/components/Tags.tsx (consumer)

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 apps/meteor/client/views/omnichannel/additionalForms/CurrentChatTags.tsx and compare its handler prop with the PaginatedMultiSelectOption type from @rocket.chat/fuselage. Check apps/meteor/client/views/omnichannel/components/Tags.tsx for consumer compatibility. Done means the handler uses the shared option type, the as any assertion and FIXME are removed, and the TypeScript checks pass.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.