fix: Properly type httpServer

This commit is contained in:
April Hall 2025-01-04 15:58:58 -05:00
parent 571160c635
commit 5c9fb0f842
Signed by: arithefirst
GPG Key ID: 4508A15C4DB91C5B
2 changed files with 4 additions and 3 deletions

View File

@ -1,10 +1,11 @@
import { building } from '$app/environment';
import type { Handle } from '@sveltejs/kit';
import { Server as SocketIOServer } from 'socket.io';
import type { HttpServer } from 'vite';
let io: SocketIOServer | undefined;
const startupSocketIOServer = (httpServer: never) => {
const startupSocketIOServer = (httpServer: HttpServer | null) => {
if (io) return;
console.log('[ws:kit] setup');
io = new SocketIOServer(httpServer);

View File

@ -1,8 +1,8 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { defineConfig, type HttpServer } from 'vite';
import { Server as SocketIOServer } from 'socket.io';
function setupSocketIOServer(httpServer: never) {
function setupSocketIOServer(httpServer: HttpServer | null) {
if (!httpServer) {
throw new Error('HTTP server is not available');
}