RocketChat / RocketChat/Rocket.Chat
Unsafe `as any` type assertion in CurrentChatTags component
Nobody has claimed this yet.
- 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.tsxapps/meteor/client/views/omnichannel/components/Tags.tsx(consumer)
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 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