chore: Update Typescript to 4.4.4 (#4188)

This commit is contained in:
Lipis 2021-11-02 14:24:16 +02:00 committed by GitHub
parent 60262cb4cc
commit 8d4f455cd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 132 additions and 125 deletions

View File

@ -1,6 +1,7 @@
{ {
"extends": ["@excalidraw/eslint-config", "react-app"], "extends": ["@excalidraw/eslint-config", "react-app"],
"rules": { "rules": {
"import/no-anonymous-default-export": "off" "import/no-anonymous-default-export": "off",
"no-restricted-globals": "off"
} }
} }

View File

@ -52,7 +52,7 @@
"roughjs": "4.4.1", "roughjs": "4.4.1",
"sass": "1.43.4", "sass": "1.43.4",
"socket.io-client": "2.3.1", "socket.io-client": "2.3.1",
"typescript": "4.2.4" "typescript": "4.4.4"
}, },
"devDependencies": { "devDependencies": {
"@excalidraw/eslint-config": "1.0.0", "@excalidraw/eslint-config": "1.0.0",
@ -61,6 +61,7 @@
"@types/lodash.throttle": "4.1.6", "@types/lodash.throttle": "4.1.6",
"@types/pako": "1.0.2", "@types/pako": "1.0.2",
"@types/resize-observer-browser": "0.1.6", "@types/resize-observer-browser": "0.1.6",
"@types/web": "0.0.45",
"chai": "4.3.4", "chai": "4.3.4",
"eslint-config-prettier": "8.3.0", "eslint-config-prettier": "8.3.0",
"eslint-plugin-prettier": "3.3.1", "eslint-plugin-prettier": "3.3.1",
@ -72,6 +73,9 @@
"prettier": "2.4.1", "prettier": "2.4.1",
"rewire": "5.0.0" "rewire": "5.0.0"
}, },
"resolutions": {
"@typescript-eslint/typescript-estree": "5.3.0"
},
"engines": { "engines": {
"node": ">=14.0.0" "node": ">=14.0.0"
}, },

View File

@ -15,8 +15,8 @@ const publish = () => {
execSync(`yarn --frozen-lockfile`, { cwd: excalidrawDir }); execSync(`yarn --frozen-lockfile`, { cwd: excalidrawDir });
execSync(`yarn run build:umd`, { cwd: excalidrawDir }); execSync(`yarn run build:umd`, { cwd: excalidrawDir });
execSync(`yarn --cwd ${excalidrawDir} publish`); execSync(`yarn --cwd ${excalidrawDir} publish`);
} catch (e) { } catch (error) {
console.error(e); console.error(error);
} }
}; };

View File

@ -25,8 +25,8 @@ const release = async (nextVersion) => {
); );
/* eslint-disable no-console */ /* eslint-disable no-console */
console.log("Done!"); console.log("Done!");
} catch (e) { } catch (error) {
console.error(e); console.error(error);
process.exit(1); process.exit(1);
} }
}; };

View File

@ -28,8 +28,8 @@ const getCommitHashForLastVersion = async () => {
`git log --format=format:"%H" --grep=${commitMessage}`, `git log --format=format:"%H" --grep=${commitMessage}`,
); );
return stdout; return stdout;
} catch (e) { } catch (error) {
console.error(e); console.error(error);
} }
}; };

View File

@ -56,7 +56,7 @@ export const actionCopyAsSvg = register({
return { return {
commitToHistory: false, commitToHistory: false,
}; };
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
return { return {
appState: { appState: {
@ -106,7 +106,7 @@ export const actionCopyAsPng = register({
}, },
commitToHistory: false, commitToHistory: false,
}; };
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
return { return {
appState: { appState: {

View File

@ -151,7 +151,7 @@ export const actionSaveToActiveFile = register({
: null, : null,
}, },
}; };
} catch (error) { } catch (error: any) {
if (error?.name !== "AbortError") { if (error?.name !== "AbortError") {
console.error(error); console.error(error);
} }
@ -181,7 +181,7 @@ export const actionSaveFileToDisk = register({
app.files, app.files,
); );
return { commitToHistory: false, appState: { ...appState, fileHandle } }; return { commitToHistory: false, appState: { ...appState, fileHandle } };
} catch (error) { } catch (error: any) {
if (error?.name !== "AbortError") { if (error?.name !== "AbortError") {
console.error(error); console.error(error);
} }
@ -219,7 +219,7 @@ export const actionLoadScene = register({
files, files,
commitToHistory: true, commitToHistory: true,
}; };
} catch (error) { } catch (error: any) {
if (error?.name === "AbortError") { if (error?.name === "AbortError") {
return false; return false;
} }

View File

@ -74,7 +74,7 @@ export const copyToClipboard = async (
try { try {
PREFER_APP_CLIPBOARD = false; PREFER_APP_CLIPBOARD = false;
await copyTextToSystemClipboard(json); await copyTextToSystemClipboard(json);
} catch (error) { } catch (error: any) {
PREFER_APP_CLIPBOARD = true; PREFER_APP_CLIPBOARD = true;
console.error(error); console.error(error);
} }
@ -87,7 +87,7 @@ const getAppClipboard = (): Partial<ElementsClipboard> => {
try { try {
return JSON.parse(CLIPBOARD); return JSON.parse(CLIPBOARD);
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
return {}; return {};
} }
@ -179,7 +179,7 @@ export const copyTextToSystemClipboard = async (text: string | null) => {
// not focused // not focused
await navigator.clipboard.writeText(text || ""); await navigator.clipboard.writeText(text || "");
copied = true; copied = true;
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
} }
} }
@ -219,7 +219,7 @@ const copyTextViaExecCommand = (text: string) => {
textarea.setSelectionRange(0, textarea.value.length); textarea.setSelectionRange(0, textarea.value.length);
success = document.execCommand("copy"); success = document.execCommand("copy");
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
} }

View File

@ -621,7 +621,7 @@ class App extends React.Component<AppProps, AppState> {
this.onBlur(); this.onBlur();
}; };
private disableEvent: EventHandlerNonNull = (event) => { private disableEvent: EventListener = (event) => {
event.preventDefault(); event.preventDefault();
}; };
@ -665,7 +665,7 @@ class App extends React.Component<AppProps, AppState> {
} }
this.setState({ isLibraryOpen: true }); this.setState({ isLibraryOpen: true });
} }
} catch (error) { } catch (error: any) {
window.alert(t("alerts.errorLoadingLibrary")); window.alert(t("alerts.errorLoadingLibrary"));
console.error(error); console.error(error);
} finally { } finally {
@ -1294,8 +1294,8 @@ class App extends React.Component<AppProps, AppState> {
if ((await this.props.onPaste(data, event)) === false) { if ((await this.props.onPaste(data, event)) === false) {
return; return;
} }
} catch (e) { } catch (error: any) {
console.error(e); console.error(error);
} }
} }
if (data.errorMessage) { if (data.errorMessage) {
@ -3705,7 +3705,7 @@ class App extends React.Component<AppProps, AppState> {
this.actionManager.executeAction(actionFinalize); this.actionManager.executeAction(actionFinalize);
}, },
); );
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
this.scene.replaceAllElements( this.scene.replaceAllElements(
this.scene this.scene
@ -3974,7 +3974,7 @@ class App extends React.Component<AppProps, AppState> {
await normalizeSVG(await imageFile.text()), await normalizeSVG(await imageFile.text()),
imageFile.name, imageFile.name,
); );
} catch (error) { } catch (error: any) {
console.warn(error); console.warn(error);
throw new Error(t("errors.svgImageInsertError")); throw new Error(t("errors.svgImageInsertError"));
} }
@ -4000,7 +4000,7 @@ class App extends React.Component<AppProps, AppState> {
imageFile, imageFile,
DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT, DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT,
); );
} catch (error) { } catch (error: any) {
console.error("error trying to resing image file on insertion", error); console.error("error trying to resing image file on insertion", error);
} }
@ -4061,7 +4061,7 @@ class App extends React.Component<AppProps, AppState> {
this.initializeImageDimensions(imageElement, true); this.initializeImageDimensions(imageElement, true);
} }
resolve(imageElement); resolve(imageElement);
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
reject(new Error(t("errors.imageInsertError"))); reject(new Error(t("errors.imageInsertError")));
} finally { } finally {
@ -4092,7 +4092,7 @@ class App extends React.Component<AppProps, AppState> {
imageElement, imageElement,
showCursorImagePreview, showCursorImagePreview,
}); });
} catch (error) { } catch (error: any) {
mutateElement(imageElement, { mutateElement(imageElement, {
isDeleted: true, isDeleted: true,
}); });
@ -4187,7 +4187,7 @@ class App extends React.Component<AppProps, AppState> {
}, },
); );
} }
} catch (error) { } catch (error: any) {
if (error.name !== "AbortError") { if (error.name !== "AbortError") {
console.error(error); console.error(error);
} }

View File

@ -61,7 +61,7 @@ export const ToolButton = React.forwardRef((props: ToolButtonProps, ref) => {
try { try {
setIsLoading(true); setIsLoading(true);
await ret; await ret;
} catch (error) { } catch (error: any) {
if (!(error instanceof AbortError)) { if (!(error instanceof AbortError)) {
throw error; throw error;
} }

View File

@ -27,7 +27,7 @@ export class TopErrorBoundary extends React.Component<
for (const [key, value] of Object.entries({ ...localStorage })) { for (const [key, value] of Object.entries({ ...localStorage })) {
try { try {
_localStorage[key] = JSON.parse(value); _localStorage[key] = JSON.parse(value);
} catch (error) { } catch (error: any) {
_localStorage[key] = value; _localStorage[key] = value;
} }
} }
@ -60,7 +60,7 @@ export class TopErrorBoundary extends React.Component<
) )
).default; ).default;
body = encodeURIComponent(templateStrFn(this.state.sentryEventId)); body = encodeURIComponent(templateStrFn(this.state.sentryEventId));
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
} }
@ -86,7 +86,7 @@ export class TopErrorBoundary extends React.Component<
try { try {
localStorage.clear(); localStorage.clear();
window.location.reload(); window.location.reload();
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
} }
}} }}

View File

@ -24,7 +24,7 @@ const parseFileContents = async (blob: Blob | File) => {
return await ( return await (
await import(/* webpackChunkName: "image" */ "./image") await import(/* webpackChunkName: "image" */ "./image")
).decodePngMetadata(blob); ).decodePngMetadata(blob);
} catch (error) { } catch (error: any) {
if (error.message === "INVALID") { if (error.message === "INVALID") {
throw new DOMException( throw new DOMException(
t("alerts.imageDoesNotContainScene"), t("alerts.imageDoesNotContainScene"),
@ -58,7 +58,7 @@ const parseFileContents = async (blob: Blob | File) => {
).decodeSvgMetadata({ ).decodeSvgMetadata({
svg: contents, svg: contents,
}); });
} catch (error) { } catch (error: any) {
if (error.message === "INVALID") { if (error.message === "INVALID") {
throw new DOMException( throw new DOMException(
t("alerts.imageDoesNotContainScene"), t("alerts.imageDoesNotContainScene"),
@ -156,7 +156,7 @@ export const loadFromBlob = async (
); );
return result; return result;
} catch (error) { } catch (error: any) {
console.error(error.message); console.error(error.message);
throw new Error(t("alerts.couldNotLoadInvalidFile")); throw new Error(t("alerts.couldNotLoadInvalidFile"));
} }
@ -187,7 +187,7 @@ export const canvasToBlob = async (
} }
resolve(blob); resolve(blob);
}); });
} catch (error) { } catch (error: any) {
reject(error); reject(error);
} }
}); });
@ -208,7 +208,7 @@ export const generateIdFromFile = async (file: File) => {
// convert to hex string // convert to hex string
.map((byte) => byte.toString(16).padStart(2, "0")) .map((byte) => byte.toString(16).padStart(2, "0"))
.join("") as FileId; .join("") as FileId;
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
// length 40 to align with the HEX length of SHA-1 (which is 160 bit) // length 40 to align with the HEX length of SHA-1 (which is 160 bit)
id = nanoid(40) as FileId; id = nanoid(40) as FileId;

View File

@ -85,7 +85,7 @@ export const encode = async ({
if (compress !== false) { if (compress !== false) {
try { try {
deflated = await toByteString(deflate(text)); deflated = await toByteString(deflate(text));
} catch (error) { } catch (error: any) {
console.error("encode: cannot deflate", error); console.error("encode: cannot deflate", error);
} }
} }
@ -367,7 +367,7 @@ export const decompressData = async <T extends Record<string, any>>(
/** data can be anything so the caller must decode it */ /** data can be anything so the caller must decode it */
data: contentsBuffer, data: contentsBuffer,
}; };
} catch (error) { } catch (error: any) {
console.error( console.error(
`Error during decompressing and decrypting the file.`, `Error during decompressing and decrypting the file.`,
encodingMetadata, encodingMetadata,

View File

@ -76,7 +76,7 @@ export const decodePngMetadata = async (blob: Blob) => {
throw new Error("FAILED"); throw new Error("FAILED");
} }
return await decode(encodedData); return await decode(encodedData);
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
throw new Error("FAILED"); throw new Error("FAILED");
} }
@ -127,7 +127,7 @@ export const decodeSvgMetadata = async ({ svg }: { svg: string }) => {
throw new Error("FAILED"); throw new Error("FAILED");
} }
return await decode(encodedData); return await decode(encodedData);
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
throw new Error("FAILED"); throw new Error("FAILED");
} }

View File

@ -93,7 +93,7 @@ export const exportCanvas = async (
} else if (type === "clipboard") { } else if (type === "clipboard") {
try { try {
await copyBlobToClipboardAsPng(blob); await copyBlobToClipboardAsPng(blob);
} catch (error) { } catch (error: any) {
if (error.name === "CANVAS_POSSIBLY_TOO_BIG") { if (error.name === "CANVAS_POSSIBLY_TOO_BIG") {
throw error; throw error;
} }

View File

@ -90,7 +90,7 @@ class Library {
this.libraryCache = JSON.parse(JSON.stringify(items)); this.libraryCache = JSON.parse(JSON.stringify(items));
resolve(items); resolve(items);
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
resolve([]); resolve([]);
} }
@ -105,7 +105,7 @@ class Library {
// immediately // immediately
this.libraryCache = JSON.parse(serializedItems); this.libraryCache = JSON.parse(serializedItems);
await this.app.props.onLibraryChange?.(items); await this.app.props.onLibraryChange?.(items);
} catch (error) { } catch (error: any) {
this.libraryCache = prevLibraryItems; this.libraryCache = prevLibraryItems;
throw error; throw error;
} }

View File

@ -63,7 +63,7 @@ export const updateImageCache = async ({
const image = await imagePromise; const image = await imagePromise;
imageCache.set(fileId, { ...data, image }); imageCache.set(fileId, { ...data, image });
} catch (error) { } catch (error: any) {
erroredFiles.set(fileId, true); erroredFiles.set(fileId, true);
} }
})(), })(),

View File

@ -230,7 +230,7 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
) => { ) => {
try { try {
await saveToFirebase(this.portal, syncableElements); await saveToFirebase(this.portal, syncableElements);
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
} }
}; };
@ -347,7 +347,7 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
scrollToContent: true, scrollToContent: true,
}); });
} }
} catch (error) { } catch (error: any) {
// log the error and move on. other peers will sync us the scene. // log the error and move on. other peers will sync us the scene.
console.error(error); console.error(error);
} }

View File

@ -95,7 +95,7 @@ class Portal {
elements: this.collab.excalidrawAPI.getSceneElementsIncludingDeleted(), elements: this.collab.excalidrawAPI.getSceneElementsIncludingDeleted(),
files: this.collab.excalidrawAPI.getFiles(), files: this.collab.excalidrawAPI.getFiles(),
}); });
} catch (error) { } catch (error: any) {
if (error.name !== "AbortError") { if (error.name !== "AbortError") {
this.collab.excalidrawAPI.updateScene({ this.collab.excalidrawAPI.updateScene({
appState: { appState: {

View File

@ -53,7 +53,7 @@ const RoomDialog = ({
const copyRoomLink = async () => { const copyRoomLink = async () => {
try { try {
await copyTextToSystemClipboard(activeRoomLink); await copyTextToSystemClipboard(activeRoomLink);
} catch (error) { } catch (error: any) {
setErrorMessage(error.message); setErrorMessage(error.message);
} }
if (roomLinkInput.current) { if (roomLinkInput.current) {
@ -68,7 +68,7 @@ const RoomDialog = ({
text: t("roomDialog.shareTitle"), text: t("roomDialog.shareTitle"),
url: activeRoomLink, url: activeRoomLink,
}); });
} catch (error) { } catch (error: any) {
// Just ignore. // Just ignore.
} }
}; };

View File

@ -93,7 +93,7 @@ export const ExportToExcalidrawPlus: React.FC<{
onClick={async () => { onClick={async () => {
try { try {
await exportToExcalidrawPlus(elements, appState, files); await exportToExcalidrawPlus(elements, appState, files);
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
if (error.name !== "AbortError") { if (error.name !== "AbortError") {
onError(new Error(t("exportDialog.excalidrawplus_exportError"))); onError(new Error(t("exportDialog.excalidrawplus_exportError")));

View File

@ -28,7 +28,7 @@ const _loadFirebase = async () => {
if (!isFirebaseInitialized) { if (!isFirebaseInitialized) {
try { try {
firebase.initializeApp(FIREBASE_CONFIG); firebase.initializeApp(FIREBASE_CONFIG);
} catch (error) { } catch (error: any) {
// trying initialize again throws. Usually this is harmless, and happens // trying initialize again throws. Usually this is harmless, and happens
// mainly in dev (HMR) // mainly in dev (HMR)
if (error.code === "app/duplicate-app") { if (error.code === "app/duplicate-app") {
@ -172,7 +172,7 @@ export const saveFilesToFirebase = async ({
}, },
); );
savedFiles.set(id, true); savedFiles.set(id, true);
} catch (error) { } catch (error: any) {
erroredFiles.set(id, true); erroredFiles.set(id, true);
} }
}), }),
@ -296,7 +296,7 @@ export const loadFilesFromFirebase = async (
} else { } else {
erroredFiles.set(id, true); erroredFiles.set(id, true);
} }
} catch (error) { } catch (error: any) {
erroredFiles.set(id, true); erroredFiles.set(id, true);
console.error(error); console.error(error);
} }

View File

@ -122,7 +122,7 @@ export const decryptAESGEM = async (
new Uint8Array(decrypted), new Uint8Array(decrypted),
); );
return JSON.parse(decodedData); return JSON.parse(decodedData);
} catch (error) { } catch (error: any) {
window.alert(t("alerts.decryptFailed")); window.alert(t("alerts.decryptFailed"));
console.error(error); console.error(error);
} }
@ -198,7 +198,7 @@ const importFromBackend = async (
const iv = buffer.slice(0, IV_LENGTH_BYTES); const iv = buffer.slice(0, IV_LENGTH_BYTES);
const encrypted = buffer.slice(IV_LENGTH_BYTES, buffer.byteLength); const encrypted = buffer.slice(IV_LENGTH_BYTES, buffer.byteLength);
decrypted = await decryptImported(iv, encrypted, privateKey); decrypted = await decryptImported(iv, encrypted, privateKey);
} catch (error) { } catch (error: any) {
// Fixed IV (old format, backward compatibility) // Fixed IV (old format, backward compatibility)
const fixedIv = new Uint8Array(IV_LENGTH_BYTES); const fixedIv = new Uint8Array(IV_LENGTH_BYTES);
decrypted = await decryptImported(fixedIv, buffer, privateKey); decrypted = await decryptImported(fixedIv, buffer, privateKey);
@ -218,7 +218,7 @@ const importFromBackend = async (
elements: data.elements || null, elements: data.elements || null,
appState: data.appState || null, appState: data.appState || null,
}; };
} catch (error) { } catch (error: any) {
window.alert(t("alerts.importBackendFailed")); window.alert(t("alerts.importBackendFailed"));
console.error(error); console.error(error);
return {}; return {};
@ -333,7 +333,7 @@ export const exportToBackend = async (
} else { } else {
window.alert(t("alerts.couldNotCreateShareableLink")); window.alert(t("alerts.couldNotCreateShareableLink"));
} }
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
window.alert(t("alerts.couldNotCreateShareableLink")); window.alert(t("alerts.couldNotCreateShareableLink"));
} }

View File

@ -20,7 +20,7 @@ export const saveUsernameToLocalStorage = (username: string) => {
STORAGE_KEYS.LOCAL_STORAGE_COLLAB, STORAGE_KEYS.LOCAL_STORAGE_COLLAB,
JSON.stringify({ username }), JSON.stringify({ username }),
); );
} catch (error) { } catch (error: any) {
// Unable to access window.localStorage // Unable to access window.localStorage
console.error(error); console.error(error);
} }
@ -32,7 +32,7 @@ export const importUsernameFromLocalStorage = (): string | null => {
if (data) { if (data) {
return JSON.parse(data).username; return JSON.parse(data).username;
} }
} catch (error) { } catch (error: any) {
// Unable to access localStorage // Unable to access localStorage
console.error(error); console.error(error);
} }
@ -53,7 +53,7 @@ export const saveToLocalStorage = (
STORAGE_KEYS.LOCAL_STORAGE_APP_STATE, STORAGE_KEYS.LOCAL_STORAGE_APP_STATE,
JSON.stringify(clearAppStateForLocalStorage(appState)), JSON.stringify(clearAppStateForLocalStorage(appState)),
); );
} catch (error) { } catch (error: any) {
// Unable to access window.localStorage // Unable to access window.localStorage
console.error(error); console.error(error);
} }
@ -66,7 +66,7 @@ export const importFromLocalStorage = () => {
try { try {
savedElements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); savedElements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS);
savedState = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_APP_STATE); savedState = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_APP_STATE);
} catch (error) { } catch (error: any) {
// Unable to access localStorage // Unable to access localStorage
console.error(error); console.error(error);
} }
@ -75,7 +75,7 @@ export const importFromLocalStorage = () => {
if (savedElements) { if (savedElements) {
try { try {
elements = clearElementsForLocalStorage(JSON.parse(savedElements)); elements = clearElementsForLocalStorage(JSON.parse(savedElements));
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
// Do nothing because elements array is already empty // Do nothing because elements array is already empty
} }
@ -90,7 +90,7 @@ export const importFromLocalStorage = () => {
JSON.parse(savedState) as Partial<AppState>, JSON.parse(savedState) as Partial<AppState>,
), ),
}; };
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
// Do nothing because appState is already null // Do nothing because appState is already null
} }
@ -103,7 +103,7 @@ export const getElementsStorageSize = () => {
const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS);
const elementsSize = elements?.length || 0; const elementsSize = elements?.length || 0;
return elementsSize; return elementsSize;
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
return 0; return 0;
} }
@ -122,7 +122,7 @@ export const getTotalStorageSize = () => {
const librarySize = library?.length || 0; const librarySize = library?.length || 0;
return appStateSize + collabSize + librarySize + getElementsStorageSize(); return appStateSize + collabSize + librarySize + getElementsStorageSize();
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
return 0; return 0;
} }

View File

@ -109,7 +109,7 @@ const localFileStorage = new FileManager({
try { try {
await set(id, fileData, filesStore); await set(id, fileData, filesStore);
savedFiles.set(id, true); savedFiles.set(id, true);
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
erroredFiles.set(id, true); erroredFiles.set(id, true);
} }
@ -228,7 +228,7 @@ const initializeScene = async (opts: {
) { ) {
return { scene: data, isExternalScene }; return { scene: data, isExternalScene };
} }
} catch (error) { } catch (error: any) {
return { return {
scene: { scene: {
appState: { appState: {
@ -377,8 +377,8 @@ const ExcalidrawWrapper = () => {
JSON.parse( JSON.parse(
localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_LIBRARY) as string, localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_LIBRARY) as string,
) || []; ) || [];
} catch (e) { } catch (error: any) {
console.error(e); console.error(error);
} }
}; };
@ -508,7 +508,7 @@ const ExcalidrawWrapper = () => {
}, },
files, files,
); );
} catch (error) { } catch (error: any) {
if (error.name !== "AbortError") { if (error.name !== "AbortError") {
const { width, height } = canvas; const { width, height } = canvas;
console.error(error, { width, height }); console.error(error, { width, height });

View File

@ -63,7 +63,7 @@
"sass-loader": "12.3.0", "sass-loader": "12.3.0",
"terser-webpack-plugin": "5.2.4", "terser-webpack-plugin": "5.2.4",
"ts-loader": "9.2.6", "ts-loader": "9.2.6",
"typescript": "4.3.5", "typescript": "4.4.4",
"webpack": "5.61.0", "webpack": "5.61.0",
"webpack-bundle-analyzer": "4.5.0", "webpack-bundle-analyzer": "4.5.0",
"webpack-cli": "4.9.1" "webpack-cli": "4.9.1"

View File

@ -2615,10 +2615,10 @@ tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
typescript@4.3.5: typescript@4.4.4:
version "4.3.5" version "4.4.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c"
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA== integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==
unicode-canonical-property-names-ecmascript@^1.0.4: unicode-canonical-property-names-ecmascript@^1.0.4:
version "1.0.4" version "1.0.4"

View File

@ -274,7 +274,7 @@ export const renderScene = (
visibleElements.forEach((element) => { visibleElements.forEach((element) => {
try { try {
renderElement(element, rc, context, renderOptimizations, sceneState); renderElement(element, rc, context, renderOptimizations, sceneState);
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
} }
}); });
@ -298,7 +298,7 @@ export const renderScene = (
renderOptimizations, renderOptimizations,
sceneState, sceneState,
); );
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
} }
} }
@ -822,7 +822,7 @@ export const renderSceneToSvg = (
element.x + offsetX, element.x + offsetX,
element.y + offsetY, element.y + offsetY,
); );
} catch (error) { } catch (error: any) {
console.error(error); console.error(error);
} }
} }

View File

@ -109,8 +109,8 @@ export const exportToSvg = async (
).encodeSvgMetadata({ ).encodeSvgMetadata({
text: serializeAsJSON(elements, appState, files || {}, "local"), text: serializeAsJSON(elements, appState, files || {}, "local"),
}); });
} catch (err) { } catch (error: any) {
console.error(err); console.error(error);
} }
} }
const [minX, minY, width, height] = getCanvasSize(elements, exportPadding); const [minX, minY, width, height] = getCanvasSize(elements, exportPadding);

View File

@ -197,7 +197,7 @@ export class API {
resolve(reader.result as string); resolve(reader.result as string);
}; };
reader.readAsText(blob); reader.readAsText(blob);
} catch (error) { } catch (error: any) {
reject(error); reject(error);
} }
}); });

View File

@ -98,7 +98,7 @@ const test = <U extends `${string}:${"L" | "R"}`>(
), ),
), ),
).deep.equal(cleanElements(remoteReconciled), "local re-reconciliation"); ).deep.equal(cleanElements(remoteReconciled), "local re-reconciliation");
} catch (error) { } catch (error: any) {
console.error("local original", __local); console.error("local original", __local);
console.error("remote reconciled", __remote); console.error("remote reconciled", __remote);
throw error; throw error;

View File

@ -7,7 +7,7 @@
"outDir": "src/packages/excalidraw/types", "outDir": "src/packages/excalidraw/types",
"jsx": "react-jsx", "jsx": "react-jsx",
"target": "es6", "target": "es6",
"lib": ["dom", "dom.iterable", "esnext"], "lib": ["esnext"],
"module": "esnext", "module": "esnext",
"moduleResolution": "node", "moduleResolution": "node",
"resolveJsonModule": true, "resolveJsonModule": true,

View File

@ -1,7 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es6", "target": "es6",
"lib": ["dom", "dom.iterable", "esnext"], "lib": ["esnext"],
"allowJs": true, "allowJs": true,
"skipLibCheck": true, "skipLibCheck": true,
"esModuleInterop": true, "esModuleInterop": true,

View File

@ -2435,6 +2435,11 @@
dependencies: dependencies:
source-map "^0.6.1" source-map "^0.6.1"
"@types/web@0.0.45":
version "0.0.45"
resolved "https://registry.yarnpkg.com/@types/web/-/web-0.0.45.tgz#835adbad37e3f6f13cb4708a93f9043af1345af4"
integrity sha512-VbDWJoWuxfnqbOU5BYQWY6hF4lT20WrcwcBKf/DrdLS2s1mEywhPgqGp6ZazZnBlHmoyZVeEyZx/+9KylQV1vg==
"@types/webpack-sources@*": "@types/webpack-sources@*":
version "2.1.0" version "2.1.0"
resolved "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-2.1.0.tgz" resolved "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-2.1.0.tgz"
@ -2540,39 +2545,23 @@
resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.19.0.tgz" resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.19.0.tgz"
integrity sha512-A4iAlexVvd4IBsSTNxdvdepW0D4uR/fwxDrKUa+iEY9UWvGREu2ZyB8ylTENM1SH8F7bVC9ac9+si3LWNxcBuA== integrity sha512-A4iAlexVvd4IBsSTNxdvdepW0D4uR/fwxDrKUa+iEY9UWvGREu2ZyB8ylTENM1SH8F7bVC9ac9+si3LWNxcBuA==
"@typescript-eslint/typescript-estree@3.10.1": "@typescript-eslint/types@5.3.0":
version "3.10.1" version "5.3.0"
resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.3.0.tgz#af29fd53867c2df0028c57c36a655bd7e9e05416"
integrity sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w== integrity sha512-fce5pG41/w8O6ahQEhXmMV+xuh4+GayzqEogN24EK+vECA3I6pUwKuLi5QbXO721EMitpQne5VKXofPonYlAQg==
dependencies:
"@typescript-eslint/types" "3.10.1"
"@typescript-eslint/visitor-keys" "3.10.1"
debug "^4.1.1"
glob "^7.1.6"
is-glob "^4.0.1"
lodash "^4.17.15"
semver "^7.3.2"
tsutils "^3.17.1"
"@typescript-eslint/typescript-estree@4.19.0": "@typescript-eslint/typescript-estree@3.10.1", "@typescript-eslint/typescript-estree@4.19.0", "@typescript-eslint/typescript-estree@5.3.0":
version "4.19.0" version "5.3.0"
resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.19.0.tgz" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.3.0.tgz#4f68ddd46dc2983182402d2ab21fb44ad94988cf"
integrity sha512-3xqArJ/A62smaQYRv2ZFyTA+XxGGWmlDYrsfZG68zJeNbeqRScnhf81rUVa6QG4UgzHnXw5VnMT5cg75dQGDkA== integrity sha512-FJ0nqcaUOpn/6Z4Jwbtf+o0valjBLkqc3MWkMvrhA2TvzFXtcclIM8F4MBEmYa2kgcI8EZeSAzwoSrIC8JYkug==
dependencies: dependencies:
"@typescript-eslint/types" "4.19.0" "@typescript-eslint/types" "5.3.0"
"@typescript-eslint/visitor-keys" "4.19.0" "@typescript-eslint/visitor-keys" "5.3.0"
debug "^4.1.1" debug "^4.3.2"
globby "^11.0.1" globby "^11.0.4"
is-glob "^4.0.1" is-glob "^4.0.3"
semver "^7.3.2" semver "^7.3.5"
tsutils "^3.17.1" tsutils "^3.21.0"
"@typescript-eslint/visitor-keys@3.10.1":
version "3.10.1"
resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz"
integrity sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ==
dependencies:
eslint-visitor-keys "^1.1.0"
"@typescript-eslint/visitor-keys@4.19.0": "@typescript-eslint/visitor-keys@4.19.0":
version "4.19.0" version "4.19.0"
@ -2582,6 +2571,14 @@
"@typescript-eslint/types" "4.19.0" "@typescript-eslint/types" "4.19.0"
eslint-visitor-keys "^2.0.0" eslint-visitor-keys "^2.0.0"
"@typescript-eslint/visitor-keys@5.3.0":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.3.0.tgz#a6258790f3b7b2547f70ed8d4a1e0c3499994523"
integrity sha512-oVIAfIQuq0x2TFDNLVavUn548WL+7hdhxYn+9j3YdJJXB7mH9dAmZNJsPDa7Jc+B9WGqoiex7GUDbyMxV0a/aw==
dependencies:
"@typescript-eslint/types" "5.3.0"
eslint-visitor-keys "^3.0.0"
"@webassemblyjs/ast@1.9.0": "@webassemblyjs/ast@1.9.0":
version "1.9.0" version "1.9.0"
resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz" resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz"
@ -6027,6 +6024,11 @@ eslint-visitor-keys@^2.0.0:
resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz" resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz"
integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==
eslint-visitor-keys@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz#e32e99c6cdc2eb063f204eda5db67bfe58bb4186"
integrity sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q==
eslint-webpack-plugin@^2.5.2: eslint-webpack-plugin@^2.5.2:
version "2.5.2" version "2.5.2"
resolved "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-2.5.2.tgz" resolved "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-2.5.2.tgz"
@ -7175,9 +7177,9 @@ globby@11.0.1:
merge2 "^1.3.0" merge2 "^1.3.0"
slash "^3.0.0" slash "^3.0.0"
globby@^11.0.1: globby@^11.0.4:
version "11.0.4" version "11.0.4"
resolved "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz" resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5"
integrity sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg== integrity sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==
dependencies: dependencies:
array-union "^2.1.0" array-union "^2.1.0"
@ -8136,9 +8138,9 @@ is-glob@^3.1.0:
dependencies: dependencies:
is-extglob "^2.1.0" is-extglob "^2.1.0"
is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1: is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1:
version "4.0.3" version "4.0.3"
resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084"
integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==
dependencies: dependencies:
is-extglob "^2.1.1" is-extglob "^2.1.1"
@ -14243,9 +14245,9 @@ tslib@^2.2.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
tsutils@^3.17.1: tsutils@^3.17.1, tsutils@^3.21.0:
version "3.21.0" version "3.21.0"
resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"
integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==
dependencies: dependencies:
tslib "^1.8.1" tslib "^1.8.1"
@ -14359,10 +14361,10 @@ typedarray@^0.0.6:
resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
typescript@4.2.4: typescript@4.4.4:
version "4.2.4" version "4.4.4"
resolved "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c"
integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg== integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==
typeson-registry@^1.0.0-alpha.20: typeson-registry@^1.0.0-alpha.20:
version "1.0.0-alpha.39" version "1.0.0-alpha.39"