fix: remove unnecessary type assertions for window.addCleanup in popover

This commit is contained in:
neerajadhav 2025-07-08 17:36:18 +05:30
parent 4d30363545
commit b3ab6fdd59

View File

@ -167,9 +167,8 @@ document.addEventListener("nav", () => {
for (const link of links) { for (const link of links) {
link.addEventListener("mouseenter", mouseEnterHandler) link.addEventListener("mouseenter", mouseEnterHandler)
link.addEventListener("mouseleave", clearActivePopoverAndHighlights) link.addEventListener("mouseleave", clearActivePopoverAndHighlights)
// Use type assertion to avoid TypeScript error when checking individual files if (typeof window.addCleanup === "function") {
if (typeof (window as any).addCleanup === "function") { window.addCleanup(() => {
;(window as any).addCleanup(() => {
link.removeEventListener("mouseenter", mouseEnterHandler) link.removeEventListener("mouseenter", mouseEnterHandler)
link.removeEventListener("mouseleave", clearActivePopoverAndHighlights) link.removeEventListener("mouseleave", clearActivePopoverAndHighlights)
}) })