fix typescript typechecking errors

This commit is contained in:
chark1es 2024-03-20 01:17:18 -07:00
parent 445bc39b9e
commit c2951c0d6f

View file

@ -201,19 +201,21 @@ import Layout from "../layouts/Layout.astro";
const { PUBLIC_SLACK_WEBHOOK_LINK } = import.meta.env; const { PUBLIC_SLACK_WEBHOOK_LINK } = import.meta.env;
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
const form = document.getElementById("contactForm"); const form = document.getElementById(
"contactForm"
) as HTMLFormElement;
const policyAgreeButton = document.querySelector( const policyAgreeButton = document.querySelector(
'button[role="switch"]' 'button[role="switch"]'
); ) as HTMLElement;
let policyAgreed = false; let policyAgreed = false;
// Toggle privacy policy agreement // Toggle privacy policy agreement
policyAgreeButton.addEventListener("click", function () { policyAgreeButton.addEventListener("click", function () {
policyAgreed = !policyAgreed; policyAgreed = !policyAgreed;
this.setAttribute("aria-checked", policyAgreed); this.setAttribute("aria-checked", policyAgreed.toString());
const indicator = this.querySelector( const indicator = this.querySelector(
'span[aria-hidden="true"]' 'span[aria-hidden="true"]'
); ) as HTMLElement;
if (policyAgreed) { if (policyAgreed) {
this.classList.replace("bg-gray-200", "bg-ieee"); this.classList.replace("bg-gray-200", "bg-ieee");
indicator.classList.replace( indicator.classList.replace(
@ -236,7 +238,7 @@ import Layout from "../layouts/Layout.astro";
return; return;
} }
const formData = new FormData(form); const formData = new FormData(form as HTMLFormElement);
const formProps = Object.fromEntries(formData); const formProps = Object.fromEntries(formData);
const discordPayload = { const discordPayload = {