#3174: Telegram: restore types after removing ts-nocheck
channel: telegram
Cluster:
Messaging Platform Improvements
## Summary
- remove ts-nocheck and restore typing across Telegram bot pipeline
- add shared Telegram message context types and typed handler signatures
- tighten proxy fetch typing and sticker cache guard
## Testing
- not run (typing-only changes)
## AI assistance
- AI-assisted (Codex CLI)
- I reviewed the changes and understand them
## Notes
- Focused on type safety after ts-nocheck removal; no runtime behavior change intended
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR removes `// @ts-nocheck` across the Telegram bot pipeline and restores stricter typing by introducing shared Telegram context types, typed handler signatures, and improved typing around proxy fetch and sticker caching. The changes primarily touch the Telegram inbound handler/dispatch path (`bot-handlers` → `buildTelegramMessageContext` → `dispatchTelegramMessage`) to make context and message processing explicitly typed, with an aim of preserving existing runtime behavior while increasing type safety.
<h3>Confidence Score: 2/5</h3>
- Not safe to merge as-is due to a likely runtime exception and a draft-streaming logic regression.
- Two changes look behavior-affecting despite the stated intent: (1) `getFile.bind(...) ?? fallback` can throw if `getFile` is missing at runtime and the fallback is effectively dead, and (2) the `canStreamDraft` gate appears to disable streaming in typical private chats by requiring a forum-thread id. The rest of the PR is mostly type-shaping and low risk.
- src/telegram/bot-handlers.ts, src/telegram/bot-message-dispatch.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#19213: Telegram: preserve DM topic thread in direct replies
by Kemalau · 2026-02-17
78.6%
#12936: fix(telegram): omit message_thread_id for private DM chats
by omair445 · 2026-02-09
78.5%
#17953: fix(telegram): prevent silent message loss and duplicate messages i...
by zuyan9 · 2026-02-16
78.3%
#19479: fix(telegram): skip redundant final edit in partial streaming mode
by v8hid · 2026-02-17
77.6%
#19375: telegram: align tool-error summaries
by NorthyIE · 2026-02-17
77.3%
#19673: fix(telegram): avoid starting streaming replies with only 1-2 words
by emanuelst · 2026-02-18
77.2%
#21804: fix: improve type safety and use project runtime logging
by hobostay · 2026-02-20
76.9%
#19800: fix(telegram): add INFO-level logging at inbound message drop paths
by katalabut · 2026-02-18
76.6%
#23297: Telegram: force curl transport and typing fix
by guhwan · 2026-02-22
76.5%
#7261: fix(telegram): preserve DM topic thread id for outbound media
by ViffyGwaanl · 2026-02-02
76.5%