Skip to content

Commit

Permalink
deactivate typescript strict mode as socketio-client has problems bui…
Browse files Browse the repository at this point in the history
…lding on github
  • Loading branch information
JannikStreek committed Jan 2, 2024
1 parent 2f92f95 commit 929e8f4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
5 changes: 2 additions & 3 deletions excalidraw-app/collab/Portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ import { newElementWith } from "../../packages/excalidraw/element/mutateElement"
import { BroadcastedExcalidrawElement } from "./reconciliation";
import { encryptData } from "../../packages/excalidraw/data/encryption";
import { PRECEDING_ELEMENT_KEY } from "../../packages/excalidraw/constants";
import { Socket } from "socket.io-client";

class Portal {
collab: TCollabClass;
socket: typeof Socket | null = null;
socket: any | 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;
Expand All @@ -33,7 +32,7 @@ class Portal {
this.collab = collab;
}

open(socket: typeof Socket, id: string, key: string) {
open(socket: any, id: string, key: string) {
this.socket = socket;
this.roomId = id;
this.roomKey = key;
Expand Down
9 changes: 4 additions & 5 deletions excalidraw-app/data/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ 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";

// private
// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -141,12 +140,12 @@ const decryptElements = async (
};

class FirebaseSceneVersionCache {
private static cache = new WeakMap<typeof Socket, number>();
static get = (socket: typeof Socket) => {
private static cache = new WeakMap<any, number>();
static get = (socket: any) => {
return FirebaseSceneVersionCache.cache.get(socket);
};
static set = (
socket: typeof Socket,
socket: any,
elements: readonly SyncableExcalidrawElement[],
) => {
FirebaseSceneVersionCache.cache.set(socket, getSceneVersion(elements));
Expand Down Expand Up @@ -288,7 +287,7 @@ export const saveToFirebase = async (
export const loadFromFirebase = async (
roomId: string,
roomKey: string,
socket: typeof Socket | null,
socket: any | null,
): Promise<readonly ExcalidrawElement[] | null> => {
const firebase = await loadFirestore();
const db = firebase.firestore();
Expand Down
5 changes: 2 additions & 3 deletions excalidraw-app/data/httpStorage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Inspired and partly copied from https://gitlab.com/kiliandeca/excalidraw-fork
// MIT, Kilian Decaderincourt

import { Socket } from "socket.io-client";
import { getSyncableElements, SyncableExcalidrawElement } from ".";
import { MIME_TYPES } from "../../packages/excalidraw/constants";
import { decompressData } from "../../packages/excalidraw/data/encode";
Expand Down Expand Up @@ -43,7 +42,7 @@ const SCENE_VERSION_LENGTH_BYTES = 4
// to prevent modifying upstream files and ease futur maintenance of this fork

const httpStorageSceneVersionCache = new WeakMap<
typeof Socket,
any,
number
>();

Expand Down Expand Up @@ -124,7 +123,7 @@ export const saveToHttpStorage = async (
export const loadFromHttpStorage = async (
roomId: string,
roomKey: string,
socket: typeof Socket | null,
socket: any | null,
): Promise<readonly ExcalidrawElement[] | null> => {
const getResponse = await fetch(
`${httpStorageBackendUrl}/rooms/${roomId}`,
Expand Down

0 comments on commit 929e8f4

Please sign in to comment.