Skip to content

chore: fix unsafe type assertions in useEmojiOne#39155

Closed
NAME-ASHWANIYADAV wants to merge 1 commit intoRocketChat:developfrom
NAME-ASHWANIYADAV:chore/fix-unsafe-type-assertion-useEmojiOne
Closed

chore: fix unsafe type assertions in useEmojiOne#39155
NAME-ASHWANIYADAV wants to merge 1 commit intoRocketChat:developfrom
NAME-ASHWANIYADAV:chore/fix-unsafe-type-assertion-useEmojiOne

Conversation

@NAME-ASHWANIYADAV
Copy link
Copy Markdown
Contributor

@NAME-ASHWANIYADAV NAME-ASHWANIYADAV commented Feb 27, 2026

Closes #39154

Replaced two as any type assertions in useEmojiOne.ts with proper type-safe alternatives.

Changes

useEmojiOne.ts

  • Replaced config.emojione as any assignment with a properly typed EmojiPackage object literal
  • Removed config.emojiCategories as any (no longer needed after source fix)
  • Removed redundant if (emoji.packages.emojione) guard since the object is always constructed

emojiPicker.ts

  • Added satisfies EmojiCategory[] annotation to emojiCategories array to validate i18n values as TranslationKey at the source

Screenshots

No UI changes — internal type safety improvement only.

Summary by CodeRabbit

  • Refactor
    • Improved compile-time type safety for emoji category definitions without changing runtime behavior.
    • Consolidated emoji package initialization into a single object assignment, simplifying setup while preserving emoji list population and update and dispatch flow.

@NAME-ASHWANIYADAV NAME-ASHWANIYADAV requested a review from a team as a code owner February 27, 2026 16:10
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Feb 27, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 27, 2026

⚠️ No Changeset found

Latest commit: 870b337

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 36865be and 870b337.

📒 Files selected for processing (2)
  • apps/meteor/app/emoji-emojione/lib/emojiPicker.ts
  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
  • apps/meteor/app/emoji-emojione/lib/emojiPicker.ts
🧠 Learnings (7)
📓 Common learnings
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: In Rocket.Chat PRs, keep feature PRs free of unrelated lockfile-only dependency bumps; prefer reverting lockfile drift or isolating such bumps into a separate "chore" commit/PR, and always use yarn install --immutable with the Yarn version pinned in package.json via Corepack.
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: Rocket.Chat repo context: When a workspace manifest on develop already pins a dependency version (e.g., packages/web-ui-registration → "rocket.chat/ui-contexts": "27.0.1"), a lockfile change in a feature PR that upgrades only that dependency’s resolution is considered a manifest-driven sync and can be kept, preferably as a small "chore: sync yarn.lock with manifests" commit.
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
📚 Learning: 2026-01-17T01:51:47.764Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
📚 Learning: 2026-02-24T19:09:09.561Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
  • apps/meteor/app/emoji-emojione/lib/emojiPicker.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
  • apps/meteor/app/emoji-emojione/lib/emojiPicker.ts
🔇 Additional comments (3)
apps/meteor/app/emoji-emojione/lib/emojiPicker.ts (1)

1-2: LGTM! Type-safe validation of emojiCategories.

Using satisfies EmojiCategory[] correctly validates that the array conforms to the expected shape at compile-time while preserving the literal types. This ensures i18n values are valid TranslationKeys without requiring as any casts downstream.

Also applies to: 19-19

apps/meteor/client/views/root/hooks/useEmojiOne.ts (2)

14-21: LGTM! Clean object literal initialization.

Replacing multiple property mutations with a single typed object literal is more idiomatic and eliminates the need for as any assertions. The structure is now type-checked against EmojiPackage at compile-time.


23-31: LGTM! Simplified emoji list population.

The removal of the redundant if (emoji.packages.emojione) guard is correct since the object is now unconditionally constructed above. The loop correctly assigns emojiPackage and registers both primary keys and shortnames in emoji.list.


Walkthrough

Added a compile-time type constraint to emojiCategories and refactored initialization of the Emojione package in the emoji hook to use a single object literal assignment instead of multiple property writes; no runtime behavior changes.

Changes

Cohort / File(s) Summary
Type Constraint on emojiCategories
apps/meteor/app/emoji-emojione/lib/emojiPicker.ts
Imported EmojiCategory as a type and appended satisfies EmojiCategory[] to the exported emojiCategories array to enforce element typing at compile time (no runtime change).
Emoji Package Initialization Refactor
apps/meteor/client/views/root/hooks/useEmojiOne.ts
Replaced granular mutations of emoji.packages.emojione with a single object literal assignment containing emojiCategories, emojisByCategory, toneList, render, renderPicker, and sprites; retained population of emoji.list, emoji.currentEmoji.emojiPackage assignment, duplication for shortnames, and emoji.dispatchUpdate; removed unsafe as any assertions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of the PR: removing unsafe type assertions in useEmojiOne and replacing them with type-safe alternatives.
Linked Issues check ✅ Passed The PR successfully addresses issue #39154 by removing two unsafe 'as any' assertions and replacing them with proper type-safe alternatives using typed object literals and satisfies annotations.
Out of Scope Changes check ✅ Passed All changes are directly related to the objective of fixing unsafe type assertions; modifications to both useEmojiOne.ts and emojiPicker.ts are necessary and within scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/meteor/client/views/root/hooks/useEmojiOne.ts (1)

23-23: Consider removing inline comment.

As per coding guidelines, TypeScript files should avoid code comments in the implementation. The comment's intent is clear from the code context.

🔧 Suggested change
-		// RocketChat.emoji.list is the collection of emojis from all emoji packages
 		for (const [key, currentEmoji] of Object.entries(config.emojione.emojioneList)) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/client/views/root/hooks/useEmojiOne.ts` at line 23, Remove the
inline comment "// RocketChat.emoji.list is the collection of emojis from all
emoji packages" from the TypeScript implementation in useEmojiOne.ts; locate the
comment near references to RocketChat.emoji.list (e.g., within the useEmojiOne
hook or where RocketChat.emoji.list is accessed) and delete that line so the
code complies with the guideline to avoid implementation comments in TS files.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/meteor/client/views/root/hooks/useEmojiOne.ts`:
- Line 23: Remove the inline comment "// RocketChat.emoji.list is the collection
of emojis from all emoji packages" from the TypeScript implementation in
useEmojiOne.ts; locate the comment near references to RocketChat.emoji.list
(e.g., within the useEmojiOne hook or where RocketChat.emoji.list is accessed)
and delete that line so the code complies with the guideline to avoid
implementation comments in TS files.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2a32553 and 530e12c.

📒 Files selected for processing (2)
  • apps/meteor/app/emoji-emojione/lib/emojiPicker.ts
  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
  • apps/meteor/app/emoji-emojione/lib/emojiPicker.ts
🧠 Learnings (6)
📓 Common learnings
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: In Rocket.Chat PRs, keep feature PRs free of unrelated lockfile-only dependency bumps; prefer reverting lockfile drift or isolating such bumps into a separate "chore" commit/PR, and always use yarn install --immutable with the Yarn version pinned in package.json via Corepack.
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: Rocket.Chat repo context: When a workspace manifest on develop already pins a dependency version (e.g., packages/web-ui-registration → "rocket.chat/ui-contexts": "27.0.1"), a lockfile change in a feature PR that upgrades only that dependency’s resolution is considered a manifest-driven sync and can be kept, preferably as a small "chore: sync yarn.lock with manifests" commit.
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
📚 Learning: 2026-01-17T01:51:47.764Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
  • apps/meteor/app/emoji-emojione/lib/emojiPicker.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
  • apps/meteor/app/emoji-emojione/lib/emojiPicker.ts
🔇 Additional comments (2)
apps/meteor/app/emoji-emojione/lib/emojiPicker.ts (1)

1-19: LGTM!

Good use of satisfies EmojiCategory[] to validate the i18n values as TranslationKey at compile time while preserving the literal types. This is the correct TypeScript approach for improving type safety without requiring runtime changes.

apps/meteor/client/views/root/hooks/useEmojiOne.ts (1)

14-21: LGTM!

Clean refactor consolidating the emoji package initialization into a single typed object literal. This properly eliminates the need for as any assertions by constructing the object inline with the expected properties.

@NAME-ASHWANIYADAV NAME-ASHWANIYADAV force-pushed the chore/fix-unsafe-type-assertion-useEmojiOne branch from 530e12c to 36865be Compare February 27, 2026 16:50
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
apps/meteor/client/views/root/hooks/useEmojiOne.ts (1)

23-31: Code looks good; minor type annotation redundancy.

The emoji list population logic is correct. The explicit type annotation on line 28 (shortname: string) may be redundant if currentEmoji.shortnames is already typed as string[], as TypeScript would infer the type.

Optional: Remove redundant type annotation
 		if (currentEmoji.shortnames) {
-			currentEmoji.shortnames.forEach((shortname: string) => {
+			currentEmoji.shortnames.forEach((shortname) => {
 				emoji.list[shortname] = currentEmoji;
 			});
 		}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/meteor/client/views/root/hooks/useEmojiOne.ts` around lines 23 - 31,
Remove the redundant explicit type annotation on the forEach callback parameter:
in useEmojiOne.ts inside the loop that iterates
Object.entries(config.emojione.emojioneList) (where currentEmoji is used and
currentEmoji.shortnames.forEach is called), drop the “: string” from the
shortname parameter so TypeScript will infer the type from
currentEmoji.shortnames; keep the rest of the population logic unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/meteor/client/views/root/hooks/useEmojiOne.ts`:
- Around line 23-31: Remove the redundant explicit type annotation on the
forEach callback parameter: in useEmojiOne.ts inside the loop that iterates
Object.entries(config.emojione.emojioneList) (where currentEmoji is used and
currentEmoji.shortnames.forEach is called), drop the “: string” from the
shortname parameter so TypeScript will infer the type from
currentEmoji.shortnames; keep the rest of the population logic unchanged.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 530e12c and 36865be.

📒 Files selected for processing (2)
  • apps/meteor/app/emoji-emojione/lib/emojiPicker.ts
  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/app/emoji-emojione/lib/emojiPicker.ts
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
🧠 Learnings (6)
📓 Common learnings
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: In Rocket.Chat PRs, keep feature PRs free of unrelated lockfile-only dependency bumps; prefer reverting lockfile drift or isolating such bumps into a separate "chore" commit/PR, and always use yarn install --immutable with the Yarn version pinned in package.json via Corepack.
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: Rocket.Chat repo context: When a workspace manifest on develop already pins a dependency version (e.g., packages/web-ui-registration → "rocket.chat/ui-contexts": "27.0.1"), a lockfile change in a feature PR that upgrades only that dependency’s resolution is considered a manifest-driven sync and can be kept, preferably as a small "chore: sync yarn.lock with manifests" commit.
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
📚 Learning: 2026-01-17T01:51:47.764Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/client/views/root/hooks/useEmojiOne.ts
🔇 Additional comments (1)
apps/meteor/client/views/root/hooks/useEmojiOne.ts (1)

14-21: LGTM! Clean type-safe object literal initialization.

This properly replaces the as any assertion with a well-structured object literal, maintaining type safety while achieving the PR objective.

@NAME-ASHWANIYADAV NAME-ASHWANIYADAV force-pushed the chore/fix-unsafe-type-assertion-useEmojiOne branch from 36865be to 870b337 Compare February 27, 2026 18:25
@engelgabriel
Copy link
Copy Markdown
Member

Closing this PR in favor of #39411, where we’re replacing Emojione with native Unicode emojis.

It’s still a draft, and we’d love help from the community to get it across the finish line 🙌

@NAME-ASHWANIYADAV
Copy link
Copy Markdown
Contributor Author

@engelgabriel Thanks for reviewing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: fix unsafe type assertions in useEmojiOne

2 participants