message_list_data: Fix type of first, first_including_muted.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-05-23 16:17:25 -07:00 committed by Anders Kaseorg
parent 26fd6be88f
commit 931f515207
2 changed files with 5 additions and 5 deletions

View File

@ -84,11 +84,11 @@ export class MessageListData {
return this._items.length === 0;
}
first(): Message {
first(): Message | undefined {
return this._items[0];
}
first_including_muted(): Message {
first_including_muted(): Message | undefined {
return this._all_items[0];
}
@ -105,7 +105,7 @@ export class MessageListData {
return false;
}
return this.first().id <= msg_id && msg_id <= this.last()!.id;
return this.first()!.id <= msg_id && msg_id <= this.last()!.id;
}
ids_greater_or_equal_than(my_id: number): number[] {
@ -335,7 +335,7 @@ export class MessageListData {
const last = this.last_including_muted();
if (last === undefined || msg.id > last.id) {
bottom_messages.push(msg);
} else if (msg.id < this.first_including_muted().id) {
} else if (msg.id < this.first_including_muted()!.id) {
top_messages.push(msg);
} else {
interior_messages.push(msg);

View File

@ -42,7 +42,7 @@ export function all_topics_in_cache(sub: StreamSubscription): boolean {
// we might be missing the oldest topics in this stream in our
// cache.
const first_cached_message = all_messages_data.first();
return first_cached_message.id <= sub.first_message_id;
return first_cached_message!.id <= sub.first_message_id;
}
export function is_complete_for_stream_id(stream_id: number): boolean {