Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
popover_menus: Avoid needless unchecked type assertion.
Anders Kaseorgfb5f53d384ee
diff --git a/web/src/popover_menus.ts b/web/src/popover_menus.tsindex 9ce707a5bd7..15d577519a6 100644--- a/web/src/popover_menus.ts+++ b/web/src/popover_menus.ts@@ -3,6 +3,7 @@popovers system in popovers.js. */import $ from "jquery";+import assert from "minimalistic-assert";import * as tippy from "tippy.js";import * as blueslip from "./blueslip.ts";@@ -219,9 +220,11 @@ export const default_popover_props: Partial<tippy.Props> = {fn({state}) {// Since the reference element can be removed from DOM, we rely on popper// here to access the tippy instance which is reliable.- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions- const instance = (state.elements.popper as tippy.PopperElement)._tippy!;- const $popover = $(state.elements.popper);+ assert(state.elements.popper instanceof HTMLDivElement);+ const popper: tippy.PopperElement = state.elements.popper;+ const instance = popper._tippy;+ assert(instance !== undefined);+ const $popover = $(popper);const $tippy_box = $popover.find(".tippy-box");const is_reference_outside_window =$tippy_box.attr("data-reference-hidden") !== undefined;