server: actually type the socket

This commit is contained in:
Reto Brunner 2024-03-24 14:23:07 +01:00
parent e9ef59b641
commit 843db1727b

View file

@ -3,7 +3,7 @@ import {Server as wsServer} from "ws";
import express, {NextFunction, Request, Response} from "express"; import express, {NextFunction, Request, Response} from "express";
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
import {Server, Socket} from "socket.io"; import {Server, Socket as ioSocket} from "socket.io";
import dns from "dns"; import dns from "dns";
import colors from "chalk"; import colors from "chalk";
import net from "net"; import net from "net";
@ -51,6 +51,8 @@ type IndexTemplateConfiguration = ServerConfiguration & {
cacheBust: string; cacheBust: string;
}; };
type Socket = ioSocket<ClientToServerEvents, ServerToClientEvents, InterServerEvents, SocketData>;
// A random number that will force clients to reload the page if it differs // A random number that will force clients to reload the page if it differs
const serverHash = Math.floor(Date.now() * Math.random()); const serverHash = Math.floor(Date.now() * Math.random());