fix: Properly type httpServer
This commit is contained in:
parent
571160c635
commit
5c9fb0f842
@ -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);
|
||||
|
@ -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');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user