diff --git a/excalidraw-app/collab/Portal.tsx b/excalidraw-app/collab/Portal.tsx index 6570944c..bf8ffa5d 100644 --- a/excalidraw-app/collab/Portal.tsx +++ b/excalidraw-app/collab/Portal.tsx @@ -23,7 +23,7 @@ import type { Socket } from "socket.io-client"; class Portal { collab: TCollabClass; - socket: SocketIOClient.Socket | null = null; + socket: Socket | null = null; socketInitialized: boolean = false; // we don't want the socket to emit any updates until it is fully initialized roomId: string | null = null; roomKey: string | null = null; @@ -33,7 +33,7 @@ class Portal { this.collab = collab; } - open(socket: SocketIOClient.Socket, id: string, key: string) { + open(socket: Socket, id: string, key: string) { this.socket = socket; this.roomId = id; this.roomKey = key; diff --git a/excalidraw-app/data/StorageBackend.ts b/excalidraw-app/data/StorageBackend.ts index 7aeff9c1..6ecd6f60 100644 --- a/excalidraw-app/data/StorageBackend.ts +++ b/excalidraw-app/data/StorageBackend.ts @@ -2,6 +2,7 @@ import { SyncableExcalidrawElement } from "."; import { ExcalidrawElement, FileId } from "../../packages/excalidraw/element/types"; import { AppState, BinaryFileData } from "../../packages/excalidraw/types"; import Portal from "../collab/Portal"; +import type { Socket } from "socket.io-client"; export interface StorageBackend { isSaved: (portal: Portal, elements: readonly ExcalidrawElement[]) => boolean; @@ -13,7 +14,7 @@ export interface StorageBackend { loadFromStorageBackend: ( roomId: string, roomKey: string, - socket: SocketIOClient.Socket | null, + socket: Socket | null, ) => Promise; saveFilesToStorageBackend: ({ prefix, diff --git a/excalidraw-app/data/firebase.ts b/excalidraw-app/data/firebase.ts index 9351a783..a8277651 100644 --- a/excalidraw-app/data/firebase.ts +++ b/excalidraw-app/data/firebase.ts @@ -21,7 +21,7 @@ import { MIME_TYPES } from "../../packages/excalidraw/constants"; import { reconcileElements } from "../collab/reconciliation"; import { getSyncableElements, SyncableExcalidrawElement } from "."; import { ResolutionType } from "../../packages/excalidraw/utility-types"; -import { Socket } from "socket.io-client"; +import type { Socket } from "socket.io-client"; // private // ----------------------------------------------------------------------------- @@ -141,12 +141,12 @@ const decryptElements = async ( }; class FirebaseSceneVersionCache { - private static cache = new WeakMap(); - static get = (socket: SocketIOClient.Socket) => { + private static cache = new WeakMap(); + static get = (socket: Socket) => { return FirebaseSceneVersionCache.cache.get(socket); }; static set = ( - socket: SocketIOClient.Socket, + socket: Socket, elements: readonly SyncableExcalidrawElement[], ) => { FirebaseSceneVersionCache.cache.set(socket, getSceneVersion(elements)); @@ -288,7 +288,7 @@ export const saveToFirebase = async ( export const loadFromFirebase = async ( roomId: string, roomKey: string, - socket: SocketIOClient.Socket | null, + socket: Socket | null, ): Promise => { const firebase = await loadFirestore(); const db = firebase.firestore(); diff --git a/excalidraw-app/data/httpStorage.ts b/excalidraw-app/data/httpStorage.ts index 4a3c89e2..375833c0 100644 --- a/excalidraw-app/data/httpStorage.ts +++ b/excalidraw-app/data/httpStorage.ts @@ -17,6 +17,7 @@ import { import Portal from "../collab/Portal"; import { reconcileElements } from "../collab/reconciliation"; import { StoredScene } from "./StorageBackend"; +import type { Socket } from "socket.io-client"; const HTTP_STORAGE_BACKEND_URL = import.meta.env.VITE_APP_HTTP_STORAGE_BACKEND_URL; const SCENE_VERSION_LENGTH_BYTES = 4 @@ -25,7 +26,7 @@ const SCENE_VERSION_LENGTH_BYTES = 4 // to prevent modifying upstream files and ease futur maintenance of this fork const httpStorageSceneVersionCache = new WeakMap< - SocketIOClient.Socket, + Socket, number >(); @@ -106,7 +107,7 @@ export const saveToHttpStorage = async ( export const loadFromHttpStorage = async ( roomId: string, roomKey: string, - socket: SocketIOClient.Socket | null, + socket: Socket | null, ): Promise => { const HTTP_STORAGE_BACKEND_URL = import.meta.env.VITE_APP_HTTP_STORAGE_BACKEND_URL; const getResponse = await fetch(