RocketChat / RocketChat/Rocket.Chat
Replace non-null assertions with proper null handling in `RealAppsEngineUIHost`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
RealAppsEngineUIHost.ts currently relies on multiple TypeScript non-null assertions (!) to bypass strict null checks.
While this satisfies the compiler, it introduces unsafe assumptions that may lead to runtime errors such as:
TypeError: Cannot read properties of undefined
These assertions should be replaced with proper null handling to improve runtime safety and make failure cases explicit.
Problem Areas
The file contains non-null assertions in the following contexts:
getUserAvatarURL(username)!username!inside room members mappingslugifiedName!getUser()!username!insidegetClientUserInfo
These assume values are always defined, which may not hold true for:
- Direct Message rooms (may not define
name) - Members without usernames
- Missing logged-in user
- Undefined avatar URLs
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 RealAppsEngineUIHost.ts and inspect the listed non-null assertions alongside the types and callers that provide those values. Define explicit behavior for missing avatars, usernames, room names, and logged-in users, then validate the changes with the repository's TypeScript checks and existing tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100