mirror of https://github.com/zulip/zulip.git
filter: Fix TypeScript noUncheckedIndexedAccess errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
beef5d259b
commit
da7d8b902b
|
@ -581,7 +581,7 @@ export class Filter {
|
||||||
return parts;
|
return parts;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (terms.length >= 2) {
|
if (terms[0] !== undefined && terms[1] !== undefined) {
|
||||||
const is = (term: NarrowTerm, expected: string): boolean =>
|
const is = (term: NarrowTerm, expected: string): boolean =>
|
||||||
Filter.canonicalize_operator(term.operator) === expected && !term.negated;
|
Filter.canonicalize_operator(term.operator) === expected && !term.negated;
|
||||||
|
|
||||||
|
@ -1151,6 +1151,7 @@ export class Filter {
|
||||||
|
|
||||||
filter_with_new_params(params: NarrowTerm): Filter {
|
filter_with_new_params(params: NarrowTerm): Filter {
|
||||||
const new_params = this.fix_terms([params])[0];
|
const new_params = this.fix_terms([params])[0];
|
||||||
|
assert(new_params !== undefined);
|
||||||
const terms = this._terms.map((term) => {
|
const terms = this._terms.map((term) => {
|
||||||
const new_term = {...term};
|
const new_term = {...term};
|
||||||
if (new_term.operator === new_params.operator && !new_term.negated) {
|
if (new_term.operator === new_params.operator && !new_term.negated) {
|
||||||
|
|
Loading…
Reference in New Issue