Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
filter: Minor refactor to help with type checking.
Aman Agrawalc84f13b41260
diff --git a/web/src/filter.ts b/web/src/filter.tsindex 77a9dd1a4e5..f9719292362 100644--- a/web/src/filter.ts+++ b/web/src/filter.ts@@ -598,16 +598,18 @@ export class Filter {}static term_type(term: NarrowTerm): string {- const operator = term.operator;- const operand = term.operand;- const negated = term.negated;+ let result = term.negated ? "not-" : "";- let result = negated ? "not-" : "";+ result += term.operator;- result += operator;-- if (["is", "has", "in", "channels"].includes(operator)) {- result += "-" + operand;+ // Using `||` instead of `array.includes` to help with type checking.+ if (+ term.operator === "is" ||+ term.operator === "has" ||+ term.operator === "in" ||+ term.operator === "channels"+ ) {+ result += "-" + term.operand;}return result;