fix: TypeScript build errors in embeds.ts and totp-settings test

- embeds.ts: non-null assert on validated octets array access
- embeds.ts: cast fetchOpts for Tauri-specific `danger` property
- totp-settings.test.ts: cast closest() result to HTMLElement for style access
This commit is contained in:
jevb
2026-03-29 21:34:54 +02:00
parent 90b4f268e2
commit e52b62482c
2 changed files with 3 additions and 3 deletions
@@ -94,7 +94,7 @@ function parseIPv4Literal(hostname: string): readonly [number, number, number, n
return null;
}
return [octets[0], octets[1], octets[2], octets[3]];
return [octets[0]!, octets[1]!, octets[2]!, octets[3]!];
}
function isPrivateHost(hostname: string): boolean {
@@ -178,7 +178,7 @@ function fetchOgMeta(url: string): Promise<OgMeta> {
headers: { "User-Agent": "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)" },
};
if (isTrustedServerUrl(url)) {
fetchOpts.danger = { acceptInvalidCerts: true, acceptInvalidHostnames: false };
(fetchOpts as RequestInit & { danger?: { acceptInvalidCerts: boolean; acceptInvalidHostnames: boolean } }).danger = { acceptInvalidCerts: true, acceptInvalidHostnames: false };
}
const res = await tauriFetch(url, fetchOpts);
clearTimeout(timer);
@@ -552,7 +552,7 @@ describe("TOTP Settings", () => {
// Disable button should reappear
expect(disableBtn.style.display).toBe("");
// The confirm area (parent of password input) should be hidden
expect(pwInput.closest("div[style*='display']")!.style.display).toBe("none");
expect((pwInput.closest("div[style*='display']") as HTMLElement).style.display).toBe("none");
overlay.destroy?.();
});