mirror of https://github.com/zulip/zulip.git
util: Stringify possibly undefined values.
This avoids "@typescript-eslint/restrict-template-expressions" when we convert util.js to util.ts. Note that prettier would otherwise split the first template literal expression in half if we don't start a newline. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
parent
a63d3507ac
commit
55793cb4d5
|
@ -413,7 +413,7 @@ test("catch_buggy_draft_error", () => {
|
|||
// An error is logged but the draft isn't fixed in this codepath.
|
||||
blueslip.expect(
|
||||
"error",
|
||||
"Cannot compare strings; at least one value is undefined: undefined, old_topic",
|
||||
"Cannot compare strings; at least one value is undefined: (undefined), old_topic",
|
||||
);
|
||||
drafts.rename_stream_recipient(
|
||||
stream_B.stream_id,
|
||||
|
|
|
@ -41,7 +41,10 @@ export function lower_bound(array, value, less) {
|
|||
|
||||
export const lower_same = function lower_same(a, b) {
|
||||
if (a === undefined || b === undefined) {
|
||||
blueslip.error(`Cannot compare strings; at least one value is undefined: ${a}, ${b}`);
|
||||
blueslip.error(
|
||||
`Cannot compare strings; at least one value is undefined: \
|
||||
${a ?? "(undefined)"}, ${b ?? "(undefined)"}`,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return a.toLowerCase() === b.toLowerCase();
|
||||
|
|
Loading…
Reference in New Issue