mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
chore: Update Typescript to 4.4.4 (#4188)
This commit is contained in:
parent
60262cb4cc
commit
8d4f455cd3
34 changed files with 132 additions and 125 deletions
|
@ -230,7 +230,7 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
|
|||
) => {
|
||||
try {
|
||||
await saveToFirebase(this.portal, syncableElements);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
@ -347,7 +347,7 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
|
|||
scrollToContent: true,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
// log the error and move on. other peers will sync us the scene.
|
||||
console.error(error);
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class Portal {
|
|||
elements: this.collab.excalidrawAPI.getSceneElementsIncludingDeleted(),
|
||||
files: this.collab.excalidrawAPI.getFiles(),
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
if (error.name !== "AbortError") {
|
||||
this.collab.excalidrawAPI.updateScene({
|
||||
appState: {
|
||||
|
|
|
@ -53,7 +53,7 @@ const RoomDialog = ({
|
|||
const copyRoomLink = async () => {
|
||||
try {
|
||||
await copyTextToSystemClipboard(activeRoomLink);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
setErrorMessage(error.message);
|
||||
}
|
||||
if (roomLinkInput.current) {
|
||||
|
@ -68,7 +68,7 @@ const RoomDialog = ({
|
|||
text: t("roomDialog.shareTitle"),
|
||||
url: activeRoomLink,
|
||||
});
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
// Just ignore.
|
||||
}
|
||||
};
|
||||
|
|
|
@ -93,7 +93,7 @@ export const ExportToExcalidrawPlus: React.FC<{
|
|||
onClick={async () => {
|
||||
try {
|
||||
await exportToExcalidrawPlus(elements, appState, files);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
if (error.name !== "AbortError") {
|
||||
onError(new Error(t("exportDialog.excalidrawplus_exportError")));
|
||||
|
|
|
@ -28,7 +28,7 @@ const _loadFirebase = async () => {
|
|||
if (!isFirebaseInitialized) {
|
||||
try {
|
||||
firebase.initializeApp(FIREBASE_CONFIG);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
// trying initialize again throws. Usually this is harmless, and happens
|
||||
// mainly in dev (HMR)
|
||||
if (error.code === "app/duplicate-app") {
|
||||
|
@ -172,7 +172,7 @@ export const saveFilesToFirebase = async ({
|
|||
},
|
||||
);
|
||||
savedFiles.set(id, true);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
erroredFiles.set(id, true);
|
||||
}
|
||||
}),
|
||||
|
@ -296,7 +296,7 @@ export const loadFilesFromFirebase = async (
|
|||
} else {
|
||||
erroredFiles.set(id, true);
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
erroredFiles.set(id, true);
|
||||
console.error(error);
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ export const decryptAESGEM = async (
|
|||
new Uint8Array(decrypted),
|
||||
);
|
||||
return JSON.parse(decodedData);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
window.alert(t("alerts.decryptFailed"));
|
||||
console.error(error);
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ const importFromBackend = async (
|
|||
const iv = buffer.slice(0, IV_LENGTH_BYTES);
|
||||
const encrypted = buffer.slice(IV_LENGTH_BYTES, buffer.byteLength);
|
||||
decrypted = await decryptImported(iv, encrypted, privateKey);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
// Fixed IV (old format, backward compatibility)
|
||||
const fixedIv = new Uint8Array(IV_LENGTH_BYTES);
|
||||
decrypted = await decryptImported(fixedIv, buffer, privateKey);
|
||||
|
@ -218,7 +218,7 @@ const importFromBackend = async (
|
|||
elements: data.elements || null,
|
||||
appState: data.appState || null,
|
||||
};
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
window.alert(t("alerts.importBackendFailed"));
|
||||
console.error(error);
|
||||
return {};
|
||||
|
@ -333,7 +333,7 @@ export const exportToBackend = async (
|
|||
} else {
|
||||
window.alert(t("alerts.couldNotCreateShareableLink"));
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
window.alert(t("alerts.couldNotCreateShareableLink"));
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ export const saveUsernameToLocalStorage = (username: string) => {
|
|||
STORAGE_KEYS.LOCAL_STORAGE_COLLAB,
|
||||
JSON.stringify({ username }),
|
||||
);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
// Unable to access window.localStorage
|
||||
console.error(error);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ export const importUsernameFromLocalStorage = (): string | null => {
|
|||
if (data) {
|
||||
return JSON.parse(data).username;
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
// Unable to access localStorage
|
||||
console.error(error);
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ export const saveToLocalStorage = (
|
|||
STORAGE_KEYS.LOCAL_STORAGE_APP_STATE,
|
||||
JSON.stringify(clearAppStateForLocalStorage(appState)),
|
||||
);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
// Unable to access window.localStorage
|
||||
console.error(error);
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ export const importFromLocalStorage = () => {
|
|||
try {
|
||||
savedElements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS);
|
||||
savedState = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_APP_STATE);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
// Unable to access localStorage
|
||||
console.error(error);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ export const importFromLocalStorage = () => {
|
|||
if (savedElements) {
|
||||
try {
|
||||
elements = clearElementsForLocalStorage(JSON.parse(savedElements));
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
// Do nothing because elements array is already empty
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ export const importFromLocalStorage = () => {
|
|||
JSON.parse(savedState) as Partial<AppState>,
|
||||
),
|
||||
};
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
// Do nothing because appState is already null
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ export const getElementsStorageSize = () => {
|
|||
const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS);
|
||||
const elementsSize = elements?.length || 0;
|
||||
return elementsSize;
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
return 0;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ export const getTotalStorageSize = () => {
|
|||
const librarySize = library?.length || 0;
|
||||
|
||||
return appStateSize + collabSize + librarySize + getElementsStorageSize();
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ const localFileStorage = new FileManager({
|
|||
try {
|
||||
await set(id, fileData, filesStore);
|
||||
savedFiles.set(id, true);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
erroredFiles.set(id, true);
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ const initializeScene = async (opts: {
|
|||
) {
|
||||
return { scene: data, isExternalScene };
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
return {
|
||||
scene: {
|
||||
appState: {
|
||||
|
@ -377,8 +377,8 @@ const ExcalidrawWrapper = () => {
|
|||
JSON.parse(
|
||||
localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_LIBRARY) as string,
|
||||
) || [];
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -508,7 +508,7 @@ const ExcalidrawWrapper = () => {
|
|||
},
|
||||
files,
|
||||
);
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
if (error.name !== "AbortError") {
|
||||
const { width, height } = canvas;
|
||||
console.error(error, { width, height });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue