client: properly type Socket in window

This commit is contained in:
Reto Brunner 2024-05-10 12:26:07 +02:00
parent 74563effa7
commit 45c2fc87ee

View file

@ -1,7 +1,9 @@
import io, {Socket} from "socket.io-client";
import io, {Socket as rawSocket} from "socket.io-client";
import type {ServerToClientEvents, ClientToServerEvents} from "../../shared/types/socket-events";
const socket: Socket<ServerToClientEvents, ClientToServerEvents> = io({
type Socket = rawSocket<ServerToClientEvents, ClientToServerEvents>;
const socket: Socket = io({
transports: JSON.parse(document.body.dataset.transports || "['polling', 'websocket']"),
path: window.location.pathname + "socket.io/",
autoConnect: false,