RocketChat / RocketChat/Rocket.Chat

chore: Improving notifyOnEmailInboxChanged type safety

Open
#38,856 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description:

This PR focuses on helping with the //TODO : improve typing remark in apps/meteor/app/lib/server/lib/notifyListener.ts. Upon understanding the places where notifyOnEmailInboxChanged is called and noticed that _id is compulsory to be passed while everything else is optional in the IEmailInbox interface.

Current Behavior
  • Parameter type is Pick<T, '_id'> | T, which:
  • Doesn’t guarantee _id without type inference.
  • Doesn’t clearly model “_id required, other fields optional.”
Expected Behavior
  • Require _id while allowing any subset of other IEmailInbox fields.
  • Reflect actual call sites (insert/update/remove/IMAP disable).
Tasks
  • Replace the parameter type with Pick<IEmailInbox, '_id'> & Partial.
  • Remove the TODO comment.

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 in apps/meteor/app/lib/server/lib/notifyListener.ts and inspect the notifyOnEmailInboxChanged declaration and its insert, update, remove, and IMAP-disable call sites. Replace the parameter type as described, remove the TODO comment, and verify that all existing calls retain a required _id while other IEmailInbox fields remain optional.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
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.