jquery: Make expectOne helper function generic.

This commit is contained in:
Lalit Kumar Singh
2023-09-07 19:54:12 +05:30
committed by Tim Abbott
parent df18d2768c
commit 8d7a9162e2
2 changed files with 3 additions and 3 deletions

View File

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