From ef727fc3832c6ecf8ae6bfb5e1fb7c1ca763aebf Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 11 Oct 2025 03:31:52 +0100 Subject: [PATCH] Resolve TSC lint and check warns --- src/lib/components/global/Tooltip.svelte | 2 +- src/routes/api/internal/diagnostics/axfr/+server.ts | 3 --- .../api/internal/diagnostics/dns-performance/+server.ts | 7 ++++--- src/routes/version/+server.ts | 1 - 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/lib/components/global/Tooltip.svelte b/src/lib/components/global/Tooltip.svelte index 9d9edc1..2765048 100644 --- a/src/lib/components/global/Tooltip.svelte +++ b/src/lib/components/global/Tooltip.svelte @@ -11,7 +11,7 @@ let { text, position = 'top', delay = 500, children }: Props = $props(); let showTooltip = $state(false); - let tooltipTimeout: number; + let tooltipTimeout: ReturnType; /** * Show tooltip after delay diff --git a/src/routes/api/internal/diagnostics/axfr/+server.ts b/src/routes/api/internal/diagnostics/axfr/+server.ts index 19e0a58..50e15b6 100644 --- a/src/routes/api/internal/diagnostics/axfr/+server.ts +++ b/src/routes/api/internal/diagnostics/axfr/+server.ts @@ -1,10 +1,7 @@ import { json, error } from '@sveltejs/kit'; import type { RequestHandler } from './$types'; -// @ts-expect-error - Node.js core modules work at runtime import { exec } from 'child_process'; -// @ts-expect-error - Node.js core modules work at runtime import { promisify } from 'util'; -// @ts-expect-error - Node.js core modules work at runtime import { promises as dns } from 'dns'; export const config = { runtime: 'nodejs22.x' }; diff --git a/src/routes/api/internal/diagnostics/dns-performance/+server.ts b/src/routes/api/internal/diagnostics/dns-performance/+server.ts index 8185d24..fd0bbdc 100644 --- a/src/routes/api/internal/diagnostics/dns-performance/+server.ts +++ b/src/routes/api/internal/diagnostics/dns-performance/+server.ts @@ -1,6 +1,7 @@ import { json, error } from '@sveltejs/kit'; import type { RequestHandler } from './$types'; import { promises as dns } from 'node:dns'; +import type { MxRecord, SoaRecord } from 'node:dns'; interface DNSPerformanceRequest { domain: string; @@ -106,8 +107,8 @@ async function queryResolver( records = await withTimeout(resolver.resolve6(domain), timeoutMs); break; case 'MX': { - const mxRecords = (await withTimeout(resolver.resolveMx(domain), timeoutMs)) as dns.MxRecord[]; - records = mxRecords.map((r: dns.MxRecord) => `${r.priority} ${r.exchange}`); + const mxRecords = (await withTimeout(resolver.resolveMx(domain), timeoutMs)) as MxRecord[]; + records = mxRecords.map((r: MxRecord) => `${r.priority} ${r.exchange}`); break; } case 'TXT': { @@ -122,7 +123,7 @@ async function queryResolver( records = await withTimeout(resolver.resolveCname(domain), timeoutMs); break; case 'SOA': { - const soaRecord = (await withTimeout(resolver.resolveSoa(domain), timeoutMs)) as dns.SoaRecord; + const soaRecord = (await withTimeout(resolver.resolveSoa(domain), timeoutMs)) as SoaRecord; records = [ `${soaRecord.nsname} ${soaRecord.hostmaster} ${soaRecord.serial} ${soaRecord.refresh} ${soaRecord.retry} ${soaRecord.expire} ${soaRecord.minttl}`, ]; diff --git a/src/routes/version/+server.ts b/src/routes/version/+server.ts index b4a598f..4ddc539 100644 --- a/src/routes/version/+server.ts +++ b/src/routes/version/+server.ts @@ -2,7 +2,6 @@ import { json } from '@sveltejs/kit'; export async function GET() { try { - // @ts-expect-error - fs is available in Node.js server context const { readFileSync } = await import('fs'); const pkg = JSON.parse(readFileSync('package.json', 'utf8')); return json({