diff --git a/src/web/inbound.ts b/src/web/inbound.ts index 8b6d7eddb..cae068285 100644 --- a/src/web/inbound.ts +++ b/src/web/inbound.ts @@ -361,7 +361,7 @@ function extractMentionedJids( const message = unwrapMessage(rawMessage); if (!message) return undefined; - const candidates: (string[] | null | undefined)[] = [ + const candidates: Array = [ message.extendedTextMessage?.contextInfo?.mentionedJid, message.extendedTextMessage?.contextInfo?.quotedMessage?.extendedTextMessage ?.contextInfo?.mentionedJid, @@ -374,7 +374,7 @@ function extractMentionedJids( message.listResponseMessage?.contextInfo?.mentionedJid, ]; - const flattened = candidates.flat().filter((j): j is string => !!j); + const flattened = candidates.flatMap((arr) => arr ?? []).filter(Boolean); if (flattened.length === 0) return undefined; // De-dupe return Array.from(new Set(flattened));