Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

chore: Update Typescript to 4.4.4 (#4188)

Lipis8d4f455cd31e
diff --git a/.eslintrc.json b/.eslintrc.json
index 87e224fa76..fbb12f59d4 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -1,6 +1,7 @@
{
"extends": ["@excalidraw/eslint-config", "react-app"],
"rules": {
- "import/no-anonymous-default-export": "off"
+ "import/no-anonymous-default-export": "off",
+ "no-restricted-globals": "off"
}
}
diff --git a/package.json b/package.json
index 201227324b..ca60e94db5 100644
--- a/package.json
+++ b/package.json
@@ -52,7 +52,7 @@
"roughjs": "4.4.1",
"sass": "1.43.4",
"socket.io-client": "2.3.1",
- "typescript": "4.2.4"
+ "typescript": "4.4.4"
},
"devDependencies": {
"@excalidraw/eslint-config": "1.0.0",
@@ -61,6 +61,7 @@
"@types/lodash.throttle": "4.1.6",
"@types/pako": "1.0.2",
"@types/resize-observer-browser": "0.1.6",
+ "@types/web": "0.0.45",
"chai": "4.3.4",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-prettier": "3.3.1",
@@ -72,6 +73,9 @@
"prettier": "2.4.1",
"rewire": "5.0.0"
},
+ "resolutions": {
+ "@typescript-eslint/typescript-estree": "5.3.0"
+ },
"engines": {
"node": ">=14.0.0"
},
diff --git a/scripts/autorelease.js b/scripts/autorelease.js
index a368748577..f567546b09 100644
--- a/scripts/autorelease.js
+++ b/scripts/autorelease.js
@@ -15,8 +15,8 @@ const publish = () => {
execSync(`yarn --frozen-lockfile`, { cwd: excalidrawDir });
execSync(`yarn run build:umd`, { cwd: excalidrawDir });
execSync(`yarn --cwd ${excalidrawDir} publish`);
- } catch (e) {
- console.error(e);
+ } catch (error) {
+ console.error(error);
}
};
diff --git a/scripts/release.js b/scripts/release.js
index 1347ef1c0a..cc14f73c95 100644
--- a/scripts/release.js
+++ b/scripts/release.js
@@ -25,8 +25,8 @@ const release = async (nextVersion) => {
);
/* eslint-disable no-console */
console.log("Done!");
- } catch (e) {
- console.error(e);
+ } catch (error) {
+ console.error(error);
process.exit(1);
}
};
diff --git a/scripts/updateChangelog.js b/scripts/updateChangelog.js
index 1ed186e47f..a378352fe0 100644
--- a/scripts/updateChangelog.js
+++ b/scripts/updateChangelog.js
@@ -28,8 +28,8 @@ const getCommitHashForLastVersion = async () => {
`git log --format=format:"%H" --grep=${commitMessage}`,
);
return stdout;
- } catch (e) {
- console.error(e);
+ } catch (error) {
+ console.error(error);
}
};
diff --git a/src/actions/actionClipboard.tsx b/src/actions/actionClipboard.tsx
index 217ee1505d..aa0dbac0e9 100644
--- a/src/actions/actionClipboard.tsx
+++ b/src/actions/actionClipboard.tsx
@@ -56,7 +56,7 @@ export const actionCopyAsSvg = register({
return {
commitToHistory: false,
};
- } catch (error) {
+ } catch (error: any) {
console.error(error);
return {
appState: {
@@ -106,7 +106,7 @@ export const actionCopyAsPng = register({
},
commitToHistory: false,
};
- } catch (error) {
+ } catch (error: any) {
console.error(error);
return {
appState: {
diff --git a/src/actions/actionExport.tsx b/src/actions/actionExport.tsx
index d080b81cda..87cb1d9423 100644
--- a/src/actions/actionExport.tsx
+++ b/src/actions/actionExport.tsx
@@ -151,7 +151,7 @@ export const actionSaveToActiveFile = register({
: null,
},
};
- } catch (error) {
+ } catch (error: any) {
if (error?.name !== "AbortError") {
console.error(error);
}
@@ -181,7 +181,7 @@ export const actionSaveFileToDisk = register({
app.files,
);
return { commitToHistory: false, appState: { ...appState, fileHandle } };
- } catch (error) {
+ } catch (error: any) {
if (error?.name !== "AbortError") {
console.error(error);
}
@@ -219,7 +219,7 @@ export const actionLoadScene = register({
files,
commitToHistory: true,
};
- } catch (error) {
+ } catch (error: any) {
if (error?.name === "AbortError") {
return false;
}
diff --git a/src/clipboard.ts b/src/clipboard.ts
index cde96eb12e..d2aa4f3601 100644
--- a/src/clipboard.ts
+++ b/src/clipboard.ts
@@ -74,7 +74,7 @@ export const copyToClipboard = async (
try {
PREFER_APP_CLIPBOARD = false;
await copyTextToSystemClipboard(json);
- } catch (error) {
+ } catch (error: any) {
PREFER_APP_CLIPBOARD = true;
console.error(error);
}
@@ -87,7 +87,7 @@ const getAppClipboard = (): Partial<ElementsClipboard> => {
try {
return JSON.parse(CLIPBOARD);
- } catch (error) {
+ } catch (error: any) {
console.error(error);
return {};
}
@@ -179,7 +179,7 @@ export const copyTextToSystemClipboard = async (text: string | null) => {
// not focused
await navigator.clipboard.writeText(text || "");
copied = true;
- } catch (error) {
+ } catch (error: any) {
console.error(error);
}
}
@@ -219,7 +219,7 @@ const copyTextViaExecCommand = (text: string) => {
textarea.setSelectionRange(0, textarea.value.length);
success = document.execCommand("copy");
- } catch (error) {
+ } catch (error: any) {
console.error(error);
}
diff --git a/src/components/App.tsx b/src/components/App.tsx
index 310c5fc091..734021e737 100644
--- a/src/components/App.tsx
+++ b/src/components/App.tsx
@@ -621,7 +621,7 @@ class App extends React.Component<AppProps, AppState> {
this.onBlur();
};
- private disableEvent: EventHandlerNonNull = (event) => {
+ private disableEvent: EventListener = (event) => {
event.preventDefault();
};
@@ -665,7 +665,7 @@ class App extends React.Component<AppProps, AppState> {
}
this.setState({ isLibraryOpen: true });
}
- } catch (error) {
+ } catch (error: any) {
window.alert(t("alerts.errorLoadingLibrary"));
console.error(error);
} finally {
@@ -1294,8 +1294,8 @@ class App extends React.Component<AppProps, AppState> {
if ((await this.props.onPaste(data, event)) === false) {
return;
}
- } catch (e) {
- console.error(e);
+ } catch (error: any) {
+ console.error(error);
}
}
if (data.errorMessage) {
@@ -3705,7 +3705,7 @@ class App extends React.Component<AppProps, AppState> {
this.actionManager.executeAction(actionFinalize);
},
);
- } catch (error) {
+ } catch (error: any) {
console.error(error);
this.scene.replaceAllElements(
this.scene
@@ -3974,7 +3974,7 @@ class App extends React.Component<AppProps, AppState> {
await normalizeSVG(await imageFile.text()),
imageFile.name,
);
- } catch (error) {
+ } catch (error: any) {
console.warn(error);
throw new Error(t("errors.svgImageInsertError"));
}
@@ -4000,7 +4000,7 @@ class App extends React.Component<AppProps, AppState> {
imageFile,
DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT,
);
- } catch (error) {
+ } catch (error: any) {
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);
}
resolve(imageElement);
- } catch (error) {
+ } catch (error: any) {
console.error(error);
reject(new Error(t("errors.imageInsertError")));
} finally {
@@ -4092,7 +4092,7 @@ class App extends React.Component<AppProps, AppState> {
imageElement,
showCursorImagePreview,
});
- } catch (error) {
+ } catch (error: any) {
mutateElement(imageElement, {
isDeleted: true,
});
@@ -4187,7 +4187,7 @@ class App extends React.Component<AppProps, AppState> {
},
);
}
- } catch (error) {
+ } catch (error: any) {
if (error.name !== "AbortError") {
console.error(error);
}
diff --git a/src/components/ToolButton.tsx b/src/components/ToolButton.tsx
index 3e3027861d..7d1c8b2bd5 100644
--- a/src/components/ToolButton.tsx
+++ b/src/components/ToolButton.tsx
@@ -61,7 +61,7 @@ export const ToolButton = React.forwardRef((props: ToolButtonProps, ref) => {
try {
setIsLoading(true);
await ret;
- } catch (error) {
+ } catch (error: any) {
if (!(error instanceof AbortError)) {
throw error;
}
diff --git a/src/components/TopErrorBoundary.tsx b/src/components/TopErrorBoundary.tsx
index 0bc67e60b2..ce81ec0923 100644
--- a/src/components/TopErrorBoundary.tsx
+++ b/src/components/TopErrorBoundary.tsx
@@ -27,7 +27,7 @@ export class TopErrorBoundary extends React.Component<
for (const [key, value] of Object.entries({ ...localStorage })) {
try {
_localStorage[key] = JSON.parse(value);
- } catch (error) {
+ } catch (error: any) {
_localStorage[key] = value;
}
}
@@ -60,7 +60,7 @@ export class TopErrorBoundary extends React.Component<
)
).default;
body = encodeURIComponent(templateStrFn(this.state.sentryEventId));
- } catch (error) {
+ } catch (error: any) {
console.error(error);
}
@@ -86,7 +86,7 @@ export class TopErrorBoundary extends React.Component<
try {
localStorage.clear();
window.location.reload();
- } catch (error) {
+ } catch (error: any) {
console.error(error);
}
}}
diff --git a/src/data/blob.ts b/src/data/blob.ts
index 09b8b3d71c..bfc41a52c6 100644
--- a/src/data/blob.ts
+++ b/src/data/blob.ts
@@ -24,7 +24,7 @@ const parseFileContents = async (blob: Blob | File) => {
return await (
await import(/* webpackChunkName: "image" */ "./image")
).decodePngMetadata(blob);
- } catch (error) {
+ } catch (error: any) {
if (error.message === "INVALID") {
throw new DOMException(
t("alerts.imageDoesNotContainScene"),
@@ -58,7 +58,7 @@ const parseFileContents = async (blob: Blob | File) => {
).decodeSvgMetadata({
svg: contents,
});
- } catch (error) {
+ } catch (error: any) {
if (error.message === "INVALID") {
throw new DOMException(
t("alerts.imageDoesNotContainScene"),
@@ -156,7 +156,7 @@ export const loadFromBlob = async (
);
return result;
- } catch (error) {
+ } catch (error: any) {
console.error(error.message);
throw new Error(t("alerts.couldNotLoadInvalidFile"));
}
@@ -187,7 +187,7 @@ export const canvasToBlob = async (
}
resolve(blob);
});
- } catch (error) {
+ } catch (error: any) {
reject(error);
}
});
@@ -208,7 +208,7 @@ export const generateIdFromFile = async (file: File) => {
// convert to hex string
.map((byte) => byte.toString(16).padStart(2, "0"))
.join("") as FileId;
- } catch (error) {
+ } catch (error: any) {
console.error(error);
// length 40 to align with the HEX length of SHA-1 (which is 160 bit)
id = nanoid(40) as FileId;
diff --git a/src/data/encode.ts b/src/data/encode.ts
index 957577f76c..75578b25dd 100644
--- a/src/data/encode.ts
+++ b/src/data/encode.ts
@@ -85,7 +85,7 @@ export const encode = async ({
if (compress !== false) {
try {
deflated = await toByteString(deflate(text));
- } catch (error) {
+ } catch (error: any) {
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: contentsBuffer,
};
- } catch (error) {
+ } catch (error: any) {
console.error(
`Error during decompressing and decrypting the file.`,
encodingMetadata,
diff --git a/src/data/image.ts b/src/data/image.ts
index faf5b5ed80..912a708433 100644
--- a/src/data/image.ts
+++ b/src/data/image.ts
@@ -76,7 +76,7 @@ export const decodePngMetadata = async (blob: Blob) => {
throw new Error("FAILED");
}
return await decode(encodedData);
- } catch (error) {
+ } catch (error: any) {
console.error(error);
throw new Error("FAILED");
}
@@ -127,7 +127,7 @@ export const decodeSvgMetadata = async ({ svg }: { svg: string }) => {
throw new Error("FAILED");
}
return await decode(encodedData);
- } catch (error) {
+ } catch (error: any) {
console.error(error);
throw new Error("FAILED");
}
diff --git a/src/data/index.ts b/src/data/index.ts
index af1abf090c..fbc4664f00 100644
--- a/src/data/index.ts
+++ b/src/data/index.ts
@@ -93,7 +93,7 @@ export const exportCanvas = async (
} else if (type === "clipboard") {
try {
await copyBlobToClipboardAsPng(blob);
- } catch (error) {
+ } catch (error: any) {
if (error.name === "CANVAS_POSSIBLY_TOO_BIG") {
throw error;
}
diff --git a/src/data/library.ts b/src/data/library.ts
index 507c349f49..95a513317b 100644
--- a/src/data/library.ts
+++ b/src/data/library.ts
@@ -90,7 +90,7 @@ class Library {
this.libraryCache = JSON.parse(JSON.stringify(items));
resolve(items);
- } catch (error) {
+ } catch (error: any) {
console.error(error);
resolve([]);
}
@@ -105,7 +105,7 @@ class Library {
// immediately
this.libraryCache = JSON.parse(serializedItems);
await this.app.props.onLibraryChange?.(items);
- } catch (error) {
+ } catch (error: any) {
this.libraryCache = prevLibraryItems;
throw error;
}
diff --git a/src/element/image.ts b/src/element/image.ts
index 11b2948134..17ba245e10 100644
--- a/src/element/image.ts
+++ b/src/element/image.ts
@@ -63,7 +63,7 @@ export const updateImageCache = async ({
const image = await imagePromise;
imageCache.set(fileId, { ...data, image });
- } catch (error) {
+ } catch (error: any) {
erroredFiles.set(fileId, true);
}
})(),
diff --git a/src/excalidraw-app/collab/CollabWrapper.tsx b/src/excalidraw-app/collab/CollabWrapper.tsx
index 0c187137a0..f85b5b1068 100644
--- a/src/excalidraw-app/collab/CollabWrapper.tsx
+++ b/src/excalidraw-app/collab/CollabWrapper.tsx
@@ -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);
}
diff --git a/src/excalidraw-app/collab/Portal.tsx b/src/excalidraw-app/collab/Portal.tsx
index de0b4cdd95..dd0a35a224 100644
--- a/src/excalidraw-app/collab/Portal.tsx
+++ b/src/excalidraw-app/collab/Portal.tsx
@@ -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: {
diff --git a/src/excalidraw-app/collab/RoomDialog.tsx b/src/excalidraw-app/collab/RoomDialog.tsx
index 0cd2f733d3..6e3857cd76 100644
--- a/src/excalidraw-app/collab/RoomDialog.tsx
+++ b/src/excalidraw-app/collab/RoomDialog.tsx
@@ -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.
}
};
diff --git a/src/excalidraw-app/components/ExportToExcalidrawPlus.tsx b/src/excalidraw-app/components/ExportToExcalidrawPlus.tsx
index da73d879bd..5cd1f541bc 100644
--- a/src/excalidraw-app/components/ExportToExcalidrawPlus.tsx
+++ b/src/excalidraw-app/components/ExportToExcalidrawPlus.tsx
@@ -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")));
diff --git a/src/excalidraw-app/data/firebase.ts b/src/excalidraw-app/data/firebase.ts
index 23de52faf1..57fc64bd7e 100644
--- a/src/excalidraw-app/data/firebase.ts
+++ b/src/excalidraw-app/data/firebase.ts
@@ -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);
}
diff --git a/src/excalidraw-app/data/index.ts b/src/excalidraw-app/data/index.ts
index d9507e3989..25d55f3e3e 100644
--- a/src/excalidraw-app/data/index.ts
+++ b/src/excalidraw-app/data/index.ts
@@ -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"));
}
diff --git a/src/excalidraw-app/data/localStorage.ts b/src/excalidraw-app/data/localStorage.ts
index f4e2b4363c..6d564bb71e 100644
--- a/src/excalidraw-app/data/localStorage.ts
+++ b/src/excalidraw-app/data/localStorage.ts
@@ -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;
}
diff --git a/src/excalidraw-app/index.tsx b/src/excalidraw-app/index.tsx
index 20b9f478ef..a17404b2e1 100644
--- a/src/excalidraw-app/index.tsx
+++ b/src/excalidraw-app/index.tsx
@@ -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 });
diff --git a/src/packages/excalidraw/package.json b/src/packages/excalidraw/package.json
index 53d34cc407..6cf09f1cbf 100644
--- a/src/packages/excalidraw/package.json
+++ b/src/packages/excalidraw/package.json
@@ -63,7 +63,7 @@
"sass-loader": "12.3.0",
"terser-webpack-plugin": "5.2.4",
"ts-loader": "9.2.6",
- "typescript": "4.3.5",
+ "typescript": "4.4.4",
"webpack": "5.61.0",
"webpack-bundle-analyzer": "4.5.0",
"webpack-cli": "4.9.1"
diff --git a/src/packages/excalidraw/yarn.lock b/src/packages/excalidraw/yarn.lock
index 899c88123a..6d7e91b7c7 100644
--- a/src/packages/excalidraw/yarn.lock
+++ b/src/packages/excalidraw/yarn.lock
@@ -2615,10 +2615,10 @@ tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
- version "4.3.5"
- resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
- integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
+ version "4.4.4"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c"
+ integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==
unicode-canonical-property-names-ecmascript@^1.0.4:
version "1.0.4"
diff --git a/src/renderer/renderScene.ts b/src/renderer/renderScene.ts
index 09406db2e0..b5d37f7864 100644
--- a/src/renderer/renderScene.ts
+++ b/src/renderer/renderScene.ts
@@ -274,7 +274,7 @@ export const renderScene = (
visibleElements.forEach((element) => {
try {
renderElement(element, rc, context, renderOptimizations, sceneState);
- } catch (error) {
+ } catch (error: any) {
console.error(error);
}
});
@@ -298,7 +298,7 @@ export const renderScene = (
renderOptimizations,
sceneState,
);
- } catch (error) {
+ } catch (error: any) {
console.error(error);
}
}
@@ -822,7 +822,7 @@ export const renderSceneToSvg = (
element.x + offsetX,
element.y + offsetY,
);
- } catch (error) {
+ } catch (error: any) {
console.error(error);
}
}
diff --git a/src/scene/export.ts b/src/scene/export.ts
index ee8ae89fc8..c586b27c7a 100644
--- a/src/scene/export.ts
+++ b/src/scene/export.ts
@@ -109,8 +109,8 @@ export const exportToSvg = async (
).encodeSvgMetadata({
text: serializeAsJSON(elements, appState, files || {}, "local"),
});
- } catch (err) {
- console.error(err);
+ } catch (error: any) {
+ console.error(error);
}
}
const [minX, minY, width, height] = getCanvasSize(elements, exportPadding);
diff --git a/src/tests/helpers/api.ts b/src/tests/helpers/api.ts
index 35812259b1..557d9e85de 100644
--- a/src/tests/helpers/api.ts
+++ b/src/tests/helpers/api.ts
@@ -197,7 +197,7 @@ export class API {
resolve(reader.result as string);
};
reader.readAsText(blob);
- } catch (error) {
+ } catch (error: any) {
reject(error);
}
});
diff --git a/src/tests/reconciliation.test.ts b/src/tests/reconciliation.test.ts
index 21d6c68213..763172927e 100644
--- a/src/tests/reconciliation.test.ts
+++ b/src/tests/reconciliation.test.ts
@@ -98,7 +98,7 @@ const test = <U extends `${string}:${"L" | "R"}`>(
),
),
).deep.equal(cleanElements(remoteReconciled), "local re-reconciliation");
- } catch (error) {
+ } catch (error: any) {
console.error("local original", __local);
console.error("remote reconciled", __remote);
throw error;
diff --git a/tsconfig-types.json b/tsconfig-types.json
index 1484598075..eca3b5a7b2 100644
--- a/tsconfig-types.json
+++ b/tsconfig-types.json
@@ -7,7 +7,7 @@
"outDir": "src/packages/excalidraw/types",
"jsx": "react-jsx",
"target": "es6",
- "lib": ["dom", "dom.iterable", "esnext"],
+ "lib": ["esnext"],
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
diff --git a/tsconfig.json b/tsconfig.json
index c8b09c92cf..8ce58b6566 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es6",
- "lib": ["dom", "dom.iterable", "esnext"],
+ "lib": ["esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
diff --git a/yarn.lock b/yarn.lock
index 0023338a0d..e40adb5e22 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2435,6 +2435,11 @@
dependencies:
source-map "^0.6.1"
+ 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@*":
version "2.1.0"
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"
integrity sha512-A4iAlexVvd4IBsSTNxdvdepW0D4uR/fwxDrKUa+iEY9UWvGREu2ZyB8ylTENM1SH8F7bVC9ac9+si3LWNxcBuA==
-"@typescript-eslint/[email protected]":
- version "3.10.1"
- resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz"
- integrity sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w==
- 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/[email protected]":
- version "4.19.0"
- resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.19.0.tgz"
- integrity sha512-3xqArJ/A62smaQYRv2ZFyTA+XxGGWmlDYrsfZG68zJeNbeqRScnhf81rUVa6QG4UgzHnXw5VnMT5cg75dQGDkA==
- dependencies:
- "@typescript-eslint/types" "4.19.0"
- "@typescript-eslint/visitor-keys" "4.19.0"
- debug "^4.1.1"
- globby "^11.0.1"
- is-glob "^4.0.1"
- semver "^7.3.2"
- tsutils "^3.17.1"
+"@typescript-eslint/[email protected]":
+ version "5.3.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.3.0.tgz#af29fd53867c2df0028c57c36a655bd7e9e05416"
+ integrity sha512-fce5pG41/w8O6ahQEhXmMV+xuh4+GayzqEogN24EK+vECA3I6pUwKuLi5QbXO721EMitpQne5VKXofPonYlAQg==
-"@typescript-eslint/[email protected]":
- version "3.10.1"
- resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz"
- integrity sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ==
+"@typescript-eslint/[email protected]", "@typescript-eslint/[email protected]", "@typescript-eslint/[email protected]":
+ version "5.3.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.3.0.tgz#4f68ddd46dc2983182402d2ab21fb44ad94988cf"
+ integrity sha512-FJ0nqcaUOpn/6Z4Jwbtf+o0valjBLkqc3MWkMvrhA2TvzFXtcclIM8F4MBEmYa2kgcI8EZeSAzwoSrIC8JYkug==
dependencies:
- eslint-visitor-keys "^1.1.0"
+ "@typescript-eslint/types" "5.3.0"
+ "@typescript-eslint/visitor-keys" "5.3.0"
+ debug "^4.3.2"
+ globby "^11.0.4"
+ is-glob "^4.0.3"
+ semver "^7.3.5"
+ tsutils "^3.21.0"
"@typescript-eslint/[email protected]":
version "4.19.0"
@@ -2582,6 +2571,14 @@
"@typescript-eslint/types" "4.19.0"
eslint-visitor-keys "^2.0.0"
+"@typescript-eslint/[email protected]":
+ 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/[email protected]":
version "1.9.0"
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"
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:
version "2.5.2"
resolved "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-2.5.2.tgz"
@@ -7175,9 +7177,9 @@ [email protected]:
merge2 "^1.3.0"
slash "^3.0.0"
-globby@^11.0.1:
+globby@^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==
dependencies:
array-union "^2.1.0"
@@ -8136,9 +8138,9 @@ is-glob@^3.1.0:
dependencies:
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"
- 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==
dependencies:
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"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
-tsutils@^3.17.1:
+tsutils@^3.17.1, tsutils@^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==
dependencies:
tslib "^1.8.1"
@@ -14359,10 +14361,10 @@ typedarray@^0.0.6:
resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
- version "4.2.4"
- resolved "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz"
- integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==
+ version "4.4.4"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c"
+ integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==
typeson-registry@^1.0.0-alpha.20:
version "1.0.0-alpha.39"