Add TypeScript types to utils.ts (issue #17)
Django CI/CD / test (push) Successful in 3m18s
Staging deployment / deploy (push) Successful in 1m18s
Staging deployment / teardown (push) Has been skipped
Django CI/CD / build-and-push (push) Has been skipped

- Add types to all function parameters and return values
- Replace getEl() with native document.querySelector() throughout
- Fix removeEventListener bug (was removing wrong function reference)
- Fix disabled property: use boolean true/false instead of strings
- Add ElementHandlerConfig labeled tuple type for conditionalElementHandler

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-15 09:22:29 +02:00
parent 783fb324ef
commit 9d77fca009
2 changed files with 240 additions and 3 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
import { getEl, disableElementsWhenTrue, onSwap } from "./utils.js";
import { disableElementsWhenTrue, onSwap } from "./utils.js";
const RELATED_PURCHASE_URL = "/tracker/purchase/related-purchase-by-game";
@@ -11,7 +11,7 @@ document.addEventListener("search-select:change", (event) => {
const last = event.detail.last;
const platformId = last && last.data ? last.data.platform : "";
if (platformId) {
const platformEl = getEl("#id_platform");
const platformEl = document.querySelector("#id_platform");
if (platformEl) platformEl.value = platformId;
}
@@ -26,7 +26,7 @@ document.addEventListener("search-select:change", (event) => {
})
.then((html) => {
if (html === null) return;
const target = getEl("#id_related_purchase");
const target = document.querySelector("#id_related_purchase");
if (target) target.outerHTML = html;
});
});