Skip to content

fix(bot): inherit workspace tsconfig in nested packages#474

Open
Jorel97 wants to merge 7 commits into
profullstack:masterfrom
Jorel97:codex/fix-bot-tsconfig-452
Open

fix(bot): inherit workspace tsconfig in nested packages#474
Jorel97 wants to merge 7 commits into
profullstack:masterfrom
Jorel97:codex/fix-bot-tsconfig-452

Conversation

@Jorel97
Copy link
Copy Markdown

@Jorel97 Jorel97 commented May 29, 2026

Summary

  • update nested packages/bot/* tsconfigs to extend the workspace base config at ../../../tsconfig.base.json
  • normalize WhatsApp Baileys message timestamps before storing them as milliseconds
  • skip WhatsApp messages with no remote JID instead of relying on a non-null assertion

Fixes #452.

Testing

  • Not run locally; change was prepared through GitHub contents API in the projectless workspace.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 29, 2026

Greptile Summary

This PR fixes two independent bugs in the WhatsApp bot package and corrects a misconfigured TypeScript path shared across all packages/bot/* sub-packages.

  • tsconfig path fix: All five packages/bot/*/tsconfig.json files were extending ../../tsconfig.base.json, which resolves to the non-existent packages/tsconfig.base.json; the correct depth is ../../../tsconfig.base.json pointing to the repo root.
  • Timestamp normalization: Replaces a bare msg.messageTimestamp * 1000 with a toUnixMs helper that handles number, string (with Number.isFinite guard), Long-style objects, and nullish values, falling back to Date.now() in all unrecognized cases.
  • remoteJid null guard: Replaces the non-null assertion msg.key.remoteJid! with an explicit if (!chatId) continue to safely skip messages that lack a remote JID.

Confidence Score: 5/5

Safe to merge — all three changes are targeted, defensive fixes with no regressions introduced.

The tsconfig path correction is mechanically verifiable. The timestamp helper covers every known Baileys type variant and falls back to Date.now() rather than propagating NaN. The remoteJid guard replaces a crash-prone non-null assertion with a safe skip.

No files require special attention.

Important Files Changed

Filename Overview
packages/bot/whatsapp/src/index.ts Adds toUnixMs helper with proper NaN/null guards for timestamp normalization; replaces non-null assertion on remoteJid with an explicit guard
packages/bot/core/tsconfig.json Corrects extends path from ../../tsconfig.base.json to ../../../tsconfig.base.json to match actual repo depth; adds trailing newline
packages/bot/discord/tsconfig.json Same tsconfig path correction as core; adds trailing newline
packages/bot/signal/tsconfig.json Same tsconfig path correction as core; adds trailing newline
packages/bot/telegram/tsconfig.json Same tsconfig path correction as core; adds trailing newline
packages/bot/whatsapp/tsconfig.json Same tsconfig path correction as core; adds trailing newline

Reviews (2): Last reviewed commit: "fix(bot): guard invalid WhatsApp timesta..." | Re-trigger Greptile

Comment thread packages/bot/whatsapp/src/index.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

packages/bot typecheck extends missing base tsconfig

1 participant