Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
bot_data: Fix TypeScript noUncheckedIndexedAccess errors.
Anders Kaseorg6cd8c9bb8c3d
diff --git a/web/src/bot_data.ts b/web/src/bot_data.tsindex ccc094c87bc..e85367dcdd4 100644--- a/web/src/bot_data.ts+++ b/web/src/bot_data.ts@@ -78,7 +78,11 @@ export function update(bot_id: number, bot_update: ServerUpdateBotData): void {// We currently only support one service per bot.const service = services.get(bot_id)![0];- if (bot_update.services !== undefined && bot_update.services.length > 0) {+ if (+ service !== undefined &&+ bot_update.services !== undefined &&+ bot_update.services.length > 0+ ) {Object.assign(service, services_schema.parse(bot_update.services)[0]);}}