RocketChat / RocketChat/Rocket.Chat
chore: Improving notifyOnEmailInboxChanged type safety
Nobody has claimed this yet.
- 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
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 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