fix: Swap TS Expect errors with proper type handling in app.d.ts

This commit is contained in:
April Hall 2025-02-16 14:57:32 -05:00
parent f54eb55f91
commit 22b3f0a72a
Signed by: arithefirst
GPG Key ID: 4508A15C4DB91C5B
2 changed files with 8 additions and 3 deletions

9
src/app.d.ts vendored
View File

@ -1,9 +1,16 @@
// See https://svelte.dev/docs/kit/types#app.d.ts // See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces // for information about these interfaces
import { Server as SocketIOServer } from 'socket.io';
import type { HttpServer } from 'vite';
declare global { declare global {
namespace App { namespace App {
// interface Error {} // interface Error {}
// interface Locals {} interface Locals {
io: SocketIOServer | undefined;
httpServer: HttpServer | null;
}
// interface PageData {} // interface PageData {}
// interface PageState {} // interface PageState {}
// interface Platform {} // interface Platform {}

View File

@ -10,9 +10,7 @@ let io: SocketIOServer | undefined;
export const handle = (async ({ event, resolve }) => { export const handle = (async ({ event, resolve }) => {
// Initialize WebSocket server if not building // Initialize WebSocket server if not building
if (!building) { if (!building) {
// @ts-expect-error hides incorrect error
startupSocketIOServer(event.locals.httpServer); startupSocketIOServer(event.locals.httpServer);
// @ts-expect-error hides incorrect error
event.locals.io = io; event.locals.io = io;
} }