Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

recent_view_ui: Fix TypeScript noUncheckedIndexedAccess errors.

Anders Kaseorg8417b540352c
diff --git a/web/src/recent_view_ui.ts b/web/src/recent_view_ui.ts
index 88d81ccdc8b..a0b669dcc38 100644
--- a/web/src/recent_view_ui.ts
+++ b/web/src/recent_view_ui.ts
@@ -289,6 +289,7 @@ function get_row_type(row: number): string {
const current_list = topics_widget.get_current_list();
const current_row = current_list[row];
+ assert(current_row !== undefined);
return current_row.type;
}
@@ -1318,7 +1319,9 @@ function is_focus_at_last_table_row(): boolean {
function has_unread(row: number): boolean {
assert(topics_widget !== undefined);
- const last_msg_id = topics_widget.get_current_list()[row].last_msg_id;
+ const current_row = topics_widget.get_current_list()[row];
+ assert(current_row !== undefined);
+ const last_msg_id = current_row.last_msg_id;
const last_msg = message_store.get(last_msg_id);
assert(last_msg !== undefined);
if (last_msg.type === "stream") {