Skip to content

Commit

Permalink
client: properly type Socket in window
Browse files Browse the repository at this point in the history
  • Loading branch information
brunnre8 committed May 10, 2024
1 parent 74563ef commit 45c2fc8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client/js/socket.ts
@@ -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,
Expand Down

0 comments on commit 45c2fc8

Please sign in to comment.