Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
filter: Fix TypeScript noUncheckedIndexedAccess errors.
Anders Kaseorgda7d8b902b94
diff --git a/web/src/filter.ts b/web/src/filter.tsindex 967375ccd0a..e8faac8b474 100644--- a/web/src/filter.ts+++ b/web/src/filter.ts@@ -581,7 +581,7 @@ export class Filter {return parts;}- if (terms.length >= 2) {+ if (terms[0] !== undefined && terms[1] !== undefined) {const is = (term: NarrowTerm, expected: string): boolean =>Filter.canonicalize_operator(term.operator) === expected && !term.negated;@@ -1151,6 +1151,7 @@ export class Filter {filter_with_new_params(params: NarrowTerm): Filter {const new_params = this.fix_terms([params])[0];+ assert(new_params !== undefined);const terms = this._terms.map((term) => {const new_term = {...term};if (new_term.operator === new_params.operator && !new_term.negated) {