diff --git a/extensions/msteams/src/monitor-handler/message-handler.ts b/extensions/msteams/src/monitor-handler/message-handler.ts index 2cc4ac7d09e..9671b0cfd19 100644 --- a/extensions/msteams/src/monitor-handler/message-handler.ts +++ b/extensions/msteams/src/monitor-handler/message-handler.ts @@ -39,18 +39,23 @@ import { wasMSTeamsBotMentioned, } from "../inbound.js"; +function isStringRecord(value: unknown): value is Record { + return typeof value === "object" && value !== null; +} + function extractTextFromHtmlAttachments(attachments: MSTeamsAttachmentLike[]): string { for (const attachment of attachments) { if (attachment.contentType !== "text/html") { continue; } + const structuredContent = isStringRecord(attachment.content) ? attachment.content : null; const raw = typeof attachment.content === "string" ? attachment.content - : typeof attachment.content?.text === "string" - ? attachment.content.text - : typeof attachment.content?.body === "string" - ? attachment.content.body + : typeof structuredContent?.text === "string" + ? structuredContent.text + : typeof structuredContent?.body === "string" + ? structuredContent.body : ""; if (!raw) { continue; diff --git a/src/gateway/server-methods/devices.ts b/src/gateway/server-methods/devices.ts index ef34f273a4b..228d11175fb 100644 --- a/src/gateway/server-methods/devices.ts +++ b/src/gateway/server-methods/devices.ts @@ -29,7 +29,7 @@ import type { GatewayRequestHandlers } from "./types.js"; const DEVICE_TOKEN_ROTATION_DENIED_MESSAGE = "device token rotation denied"; type DeviceTokenRotateTarget = { - pairedDevice: Awaited>; + pairedDevice: NonNullable>>; normalizedRole: string; };