narrow_state: Fix TypeScript noUncheckedIndexedAccess errors.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2024-05-30 10:07:59 -07:00
parent ab3110817f
commit df849b294a
1 changed files with 2 additions and 2 deletions

View File

@ -121,7 +121,7 @@ export function stream_name(current_filter: Filter | undefined = filter()): stri
return undefined;
}
const stream_operands = current_filter.operands("channel");
if (stream_operands.length === 1) {
if (stream_operands.length === 1 && stream_operands[0] !== undefined) {
const name = stream_operands[0];
// Use get_name() to get the most current stream
@ -139,7 +139,7 @@ export function stream_sub(
}
const stream_operands = current_filter.operands("channel");
if (stream_operands.length !== 1) {
if (stream_operands.length !== 1 || stream_operands[0] === undefined) {
return undefined;
}