setup: Fix wildly unsafe cast in $.fn.expectOne.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2023-09-08 13:13:54 -07:00
committed by Tim Abbott
parent affdffdda5
commit 55e4be0939
3 changed files with 4 additions and 4 deletions

View File

@@ -26,10 +26,10 @@ $(() => {
return this[0].getBoundingClientRect();
};
$.fn.expectOne = function <T>() {
$.fn.expectOne = function () {
if (blueslip && this.length !== 1) {
blueslip.error("Expected one element in jQuery set", {length: this.length});
}
return this as JQuery<T>;
return this;
};
});