diff --git a/web/src/scroll_util.ts b/web/src/scroll_util.ts index ded4918427..b54b591fa8 100644 --- a/web/src/scroll_util.ts +++ b/web/src/scroll_util.ts @@ -1,5 +1,4 @@ import $ from "jquery"; -import assert from "minimalistic-assert"; import SimpleBar from "simplebar"; // This type is helpful for testing, where we may have a dummy object instead of an actual jquery object. @@ -7,9 +6,8 @@ type JQueryOrZJQuery = {__zjquery?: true} & JQuery; export function get_content_element($element: JQuery): JQuery { const element = $element.expectOne()[0]; - const sb: unknown = SimpleBar.instances.get(element); + const sb = SimpleBar.instances.get(element); if (sb) { - assert(sb instanceof SimpleBar); // https://github.com/Grsmto/simplebar/pull/689 return $(sb.getContentElement()!); } return $element; @@ -22,9 +20,8 @@ export function get_scroll_element($element: JQueryOrZJQuery): JQuery { } const element = $element.expectOne()[0]; - const sb: unknown = SimpleBar.instances.get(element); + const sb = SimpleBar.instances.get(element); if (sb) { - assert(sb instanceof SimpleBar); // https://github.com/Grsmto/simplebar/pull/689 return $(sb.getScrollElement()!); } else if ("simplebar" in element.dataset) { // The SimpleBar mutation observer hasn’t processed this element yet. @@ -36,9 +33,8 @@ export function get_scroll_element($element: JQueryOrZJQuery): JQuery { export function reset_scrollbar($element: JQuery): void { const element = $element.expectOne()[0]; - const sb: unknown = SimpleBar.instances.get(element); + const sb = SimpleBar.instances.get(element); if (sb) { - assert(sb instanceof SimpleBar); // https://github.com/Grsmto/simplebar/pull/689 sb.getScrollElement()!.scrollTop = 0; } else { element.scrollTop = 0;