#21804: fix: improve type safety and use project runtime logging
channel: discord
channel: telegram
size: XS
Cluster:
Session Management and Fixes
This PR improves type safety and logging consistency:
- Add `DiscordMemberLike` type to replace 'any' in sender-identity.ts
- Replace direct console usage with defaultRuntime in telegram modules
- Improves type safety and logging consistency across the codebase
## Changes
- **Type Safety**: Replaced 'any' types with proper TypeScript interfaces
- **Logging**: Unified console logging to use the project's runtime logging system
- **Consistency**: All logging now goes through the same abstraction layer
## Files Changed
- src/discord/monitor/sender-identity.ts
- src/telegram/accounts.ts
- src/telegram/bot-access.ts
- src/telegram/bot.ts
- src/telegram/monitor.ts
- src/telegram/send.ts
All changes pass the pre-commit hooks (oxlint, oxfmt) and TypeScript type checking.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR improves type safety and standardizes logging across Discord and Telegram modules:
- Replaced `any` type with explicit `DiscordMemberLike` type in `src/discord/monitor/sender-identity.ts`, improving type safety for the `member` parameter
- Unified logging across all Telegram modules by replacing direct `console.log`, `console.warn`, and `console.error` calls with `defaultRuntime.log` and `defaultRuntime.error`
- All changes are consistent with the project's runtime logging abstraction defined in `src/runtime.ts`, which provides centralized control over logging behavior (including test environment suppression and progress line clearing)
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- All changes are low-risk refactorings that improve code quality. The type safety improvement replaces `any` with a properly typed interface, and the logging standardization uses the existing project runtime abstraction. Changes passed pre-commit hooks (oxlint, oxfmt) and TypeScript type checking.
- No files require special attention
<sub>Last reviewed commit: 0f82a7a</sub>
<!-- greptile_other_comments_section -->
<sub>(4/5) You can add custom instructions or style guidelines for the agent [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#13884: feat: Replace any types with proper TypeScript interfaces for bette...
by trevorgordon981 · 2026-02-11
81.3%
#3174: Telegram: restore types after removing ts-nocheck
by yashgo0018 · 2026-01-28
76.9%
#19800: fix(telegram): add INFO-level logging at inbound message drop paths
by katalabut · 2026-02-18
76.6%
#21463: fix(discord): prevent WebSocket death spiral + fix numeric channel ID…
by akropp · 2026-02-20
75.7%
#23772: fix(ci): unblock repo-wide check gate type regressions
by SmithLabsLLC · 2026-02-22
75.3%
#8166: fix(telegram): lifecycle fixes for duplicate messages and auto-reco...
by cheenu1092-oss · 2026-02-03
75.1%
#15759: discord: fix sender undefined type errors in message handler
by bniceley50 · 2026-02-13
75.1%
#16548: fix(telegram): enhance chat_id validation and diagnostics
by tanujbhaud · 2026-02-14
74.8%
#3186: fix(telegram): sanitize update offset + lock polling
by daxiong888 · 2026-01-28
74.7%
#7141: fix(telegram): unify network error detection to prevent poll crashes
by hclsys · 2026-02-02
74.7%