Browse Source

chore: Update Typescript to 4.4.4 (#4188)

vanilla_orig
Lipis 3 years ago
parent
commit
8d4f455cd3
No account linked to committer's email address

+ 2
- 1
.eslintrc.json View File

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

+ 5
- 1
package.json View File

@@ -52,7 +52,7 @@
52 52
     "roughjs": "4.4.1",
53 53
     "sass": "1.43.4",
54 54
     "socket.io-client": "2.3.1",
55
-    "typescript": "4.2.4"
55
+    "typescript": "4.4.4"
56 56
   },
57 57
   "devDependencies": {
58 58
     "@excalidraw/eslint-config": "1.0.0",
@@ -61,6 +61,7 @@
61 61
     "@types/lodash.throttle": "4.1.6",
62 62
     "@types/pako": "1.0.2",
63 63
     "@types/resize-observer-browser": "0.1.6",
64
+    "@types/web": "0.0.45",
64 65
     "chai": "4.3.4",
65 66
     "eslint-config-prettier": "8.3.0",
66 67
     "eslint-plugin-prettier": "3.3.1",
@@ -72,6 +73,9 @@
72 73
     "prettier": "2.4.1",
73 74
     "rewire": "5.0.0"
74 75
   },
76
+  "resolutions": {
77
+    "@typescript-eslint/typescript-estree": "5.3.0"
78
+  },
75 79
   "engines": {
76 80
     "node": ">=14.0.0"
77 81
   },

+ 2
- 2
scripts/autorelease.js View File

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

+ 2
- 2
scripts/release.js View File

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

+ 2
- 2
scripts/updateChangelog.js View File

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

+ 2
- 2
src/actions/actionClipboard.tsx View File

@@ -56,7 +56,7 @@ export const actionCopyAsSvg = register({
56 56
       return {
57 57
         commitToHistory: false,
58 58
       };
59
-    } catch (error) {
59
+    } catch (error: any) {
60 60
       console.error(error);
61 61
       return {
62 62
         appState: {
@@ -106,7 +106,7 @@ export const actionCopyAsPng = register({
106 106
         },
107 107
         commitToHistory: false,
108 108
       };
109
-    } catch (error) {
109
+    } catch (error: any) {
110 110
       console.error(error);
111 111
       return {
112 112
         appState: {

+ 3
- 3
src/actions/actionExport.tsx View File

@@ -151,7 +151,7 @@ export const actionSaveToActiveFile = register({
151 151
             : null,
152 152
         },
153 153
       };
154
-    } catch (error) {
154
+    } catch (error: any) {
155 155
       if (error?.name !== "AbortError") {
156 156
         console.error(error);
157 157
       }
@@ -181,7 +181,7 @@ export const actionSaveFileToDisk = register({
181 181
         app.files,
182 182
       );
183 183
       return { commitToHistory: false, appState: { ...appState, fileHandle } };
184
-    } catch (error) {
184
+    } catch (error: any) {
185 185
       if (error?.name !== "AbortError") {
186 186
         console.error(error);
187 187
       }
@@ -219,7 +219,7 @@ export const actionLoadScene = register({
219 219
         files,
220 220
         commitToHistory: true,
221 221
       };
222
-    } catch (error) {
222
+    } catch (error: any) {
223 223
       if (error?.name === "AbortError") {
224 224
         return false;
225 225
       }

+ 4
- 4
src/clipboard.ts View File

@@ -74,7 +74,7 @@ export const copyToClipboard = async (
74 74
   try {
75 75
     PREFER_APP_CLIPBOARD = false;
76 76
     await copyTextToSystemClipboard(json);
77
-  } catch (error) {
77
+  } catch (error: any) {
78 78
     PREFER_APP_CLIPBOARD = true;
79 79
     console.error(error);
80 80
   }
@@ -87,7 +87,7 @@ const getAppClipboard = (): Partial<ElementsClipboard> => {
87 87
 
88 88
   try {
89 89
     return JSON.parse(CLIPBOARD);
90
-  } catch (error) {
90
+  } catch (error: any) {
91 91
     console.error(error);
92 92
     return {};
93 93
   }
@@ -179,7 +179,7 @@ export const copyTextToSystemClipboard = async (text: string | null) => {
179 179
       // not focused
180 180
       await navigator.clipboard.writeText(text || "");
181 181
       copied = true;
182
-    } catch (error) {
182
+    } catch (error: any) {
183 183
       console.error(error);
184 184
     }
185 185
   }
@@ -219,7 +219,7 @@ const copyTextViaExecCommand = (text: string) => {
219 219
     textarea.setSelectionRange(0, textarea.value.length);
220 220
 
221 221
     success = document.execCommand("copy");
222
-  } catch (error) {
222
+  } catch (error: any) {
223 223
     console.error(error);
224 224
   }
225 225
 

+ 10
- 10
src/components/App.tsx View File

@@ -621,7 +621,7 @@ class App extends React.Component<AppProps, AppState> {
621 621
     this.onBlur();
622 622
   };
623 623
 
624
-  private disableEvent: EventHandlerNonNull = (event) => {
624
+  private disableEvent: EventListener = (event) => {
625 625
     event.preventDefault();
626 626
   };
627 627
 
@@ -665,7 +665,7 @@ class App extends React.Component<AppProps, AppState> {
665 665
         }
666 666
         this.setState({ isLibraryOpen: true });
667 667
       }
668
-    } catch (error) {
668
+    } catch (error: any) {
669 669
       window.alert(t("alerts.errorLoadingLibrary"));
670 670
       console.error(error);
671 671
     } finally {
@@ -1294,8 +1294,8 @@ class App extends React.Component<AppProps, AppState> {
1294 1294
           if ((await this.props.onPaste(data, event)) === false) {
1295 1295
             return;
1296 1296
           }
1297
-        } catch (e) {
1298
-          console.error(e);
1297
+        } catch (error: any) {
1298
+          console.error(error);
1299 1299
         }
1300 1300
       }
1301 1301
       if (data.errorMessage) {
@@ -3705,7 +3705,7 @@ class App extends React.Component<AppProps, AppState> {
3705 3705
               this.actionManager.executeAction(actionFinalize);
3706 3706
             },
3707 3707
           );
3708
-        } catch (error) {
3708
+        } catch (error: any) {
3709 3709
           console.error(error);
3710 3710
           this.scene.replaceAllElements(
3711 3711
             this.scene
@@ -3974,7 +3974,7 @@ class App extends React.Component<AppProps, AppState> {
3974 3974
           await normalizeSVG(await imageFile.text()),
3975 3975
           imageFile.name,
3976 3976
         );
3977
-      } catch (error) {
3977
+      } catch (error: any) {
3978 3978
         console.warn(error);
3979 3979
         throw new Error(t("errors.svgImageInsertError"));
3980 3980
       }
@@ -4000,7 +4000,7 @@ class App extends React.Component<AppProps, AppState> {
4000 4000
           imageFile,
4001 4001
           DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT,
4002 4002
         );
4003
-      } catch (error) {
4003
+      } catch (error: any) {
4004 4004
         console.error("error trying to resing image file on insertion", error);
4005 4005
       }
4006 4006
 
@@ -4061,7 +4061,7 @@ class App extends React.Component<AppProps, AppState> {
4061 4061
             this.initializeImageDimensions(imageElement, true);
4062 4062
           }
4063 4063
           resolve(imageElement);
4064
-        } catch (error) {
4064
+        } catch (error: any) {
4065 4065
           console.error(error);
4066 4066
           reject(new Error(t("errors.imageInsertError")));
4067 4067
         } finally {
@@ -4092,7 +4092,7 @@ class App extends React.Component<AppProps, AppState> {
4092 4092
         imageElement,
4093 4093
         showCursorImagePreview,
4094 4094
       });
4095
-    } catch (error) {
4095
+    } catch (error: any) {
4096 4096
       mutateElement(imageElement, {
4097 4097
         isDeleted: true,
4098 4098
       });
@@ -4187,7 +4187,7 @@ class App extends React.Component<AppProps, AppState> {
4187 4187
           },
4188 4188
         );
4189 4189
       }
4190
-    } catch (error) {
4190
+    } catch (error: any) {
4191 4191
       if (error.name !== "AbortError") {
4192 4192
         console.error(error);
4193 4193
       }

+ 1
- 1
src/components/ToolButton.tsx View File

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

+ 3
- 3
src/components/TopErrorBoundary.tsx View File

@@ -27,7 +27,7 @@ export class TopErrorBoundary extends React.Component<
27 27
     for (const [key, value] of Object.entries({ ...localStorage })) {
28 28
       try {
29 29
         _localStorage[key] = JSON.parse(value);
30
-      } catch (error) {
30
+      } catch (error: any) {
31 31
         _localStorage[key] = value;
32 32
       }
33 33
     }
@@ -60,7 +60,7 @@ export class TopErrorBoundary extends React.Component<
60 60
         )
61 61
       ).default;
62 62
       body = encodeURIComponent(templateStrFn(this.state.sentryEventId));
63
-    } catch (error) {
63
+    } catch (error: any) {
64 64
       console.error(error);
65 65
     }
66 66
 
@@ -86,7 +86,7 @@ export class TopErrorBoundary extends React.Component<
86 86
                 try {
87 87
                   localStorage.clear();
88 88
                   window.location.reload();
89
-                } catch (error) {
89
+                } catch (error: any) {
90 90
                   console.error(error);
91 91
                 }
92 92
               }}

+ 5
- 5
src/data/blob.ts View File

@@ -24,7 +24,7 @@ const parseFileContents = async (blob: Blob | File) => {
24 24
       return await (
25 25
         await import(/* webpackChunkName: "image" */ "./image")
26 26
       ).decodePngMetadata(blob);
27
-    } catch (error) {
27
+    } catch (error: any) {
28 28
       if (error.message === "INVALID") {
29 29
         throw new DOMException(
30 30
           t("alerts.imageDoesNotContainScene"),
@@ -58,7 +58,7 @@ const parseFileContents = async (blob: Blob | File) => {
58 58
         ).decodeSvgMetadata({
59 59
           svg: contents,
60 60
         });
61
-      } catch (error) {
61
+      } catch (error: any) {
62 62
         if (error.message === "INVALID") {
63 63
           throw new DOMException(
64 64
             t("alerts.imageDoesNotContainScene"),
@@ -156,7 +156,7 @@ export const loadFromBlob = async (
156 156
     );
157 157
 
158 158
     return result;
159
-  } catch (error) {
159
+  } catch (error: any) {
160 160
     console.error(error.message);
161 161
     throw new Error(t("alerts.couldNotLoadInvalidFile"));
162 162
   }
@@ -187,7 +187,7 @@ export const canvasToBlob = async (
187 187
         }
188 188
         resolve(blob);
189 189
       });
190
-    } catch (error) {
190
+    } catch (error: any) {
191 191
       reject(error);
192 192
     }
193 193
   });
@@ -208,7 +208,7 @@ export const generateIdFromFile = async (file: File) => {
208 208
         // convert to hex string
209 209
         .map((byte) => byte.toString(16).padStart(2, "0"))
210 210
         .join("") as FileId;
211
-  } catch (error) {
211
+  } catch (error: any) {
212 212
     console.error(error);
213 213
     // length 40 to align with the HEX length of SHA-1 (which is 160 bit)
214 214
     id = nanoid(40) as FileId;

+ 2
- 2
src/data/encode.ts View File

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

+ 2
- 2
src/data/image.ts View File

@@ -76,7 +76,7 @@ export const decodePngMetadata = async (blob: Blob) => {
76 76
         throw new Error("FAILED");
77 77
       }
78 78
       return await decode(encodedData);
79
-    } catch (error) {
79
+    } catch (error: any) {
80 80
       console.error(error);
81 81
       throw new Error("FAILED");
82 82
     }
@@ -127,7 +127,7 @@ export const decodeSvgMetadata = async ({ svg }: { svg: string }) => {
127 127
         throw new Error("FAILED");
128 128
       }
129 129
       return await decode(encodedData);
130
-    } catch (error) {
130
+    } catch (error: any) {
131 131
       console.error(error);
132 132
       throw new Error("FAILED");
133 133
     }

+ 1
- 1
src/data/index.ts View File

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

+ 2
- 2
src/data/library.ts View File

@@ -90,7 +90,7 @@ class Library {
90 90
         this.libraryCache = JSON.parse(JSON.stringify(items));
91 91
 
92 92
         resolve(items);
93
-      } catch (error) {
93
+      } catch (error: any) {
94 94
         console.error(error);
95 95
         resolve([]);
96 96
       }
@@ -105,7 +105,7 @@ class Library {
105 105
       // immediately
106 106
       this.libraryCache = JSON.parse(serializedItems);
107 107
       await this.app.props.onLibraryChange?.(items);
108
-    } catch (error) {
108
+    } catch (error: any) {
109 109
       this.libraryCache = prevLibraryItems;
110 110
       throw error;
111 111
     }

+ 1
- 1
src/element/image.ts View File

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

+ 2
- 2
src/excalidraw-app/collab/CollabWrapper.tsx View File

@@ -230,7 +230,7 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
230 230
   ) => {
231 231
     try {
232 232
       await saveToFirebase(this.portal, syncableElements);
233
-    } catch (error) {
233
+    } catch (error: any) {
234 234
       console.error(error);
235 235
     }
236 236
   };
@@ -347,7 +347,7 @@ class CollabWrapper extends PureComponent<Props, CollabState> {
347 347
             scrollToContent: true,
348 348
           });
349 349
         }
350
-      } catch (error) {
350
+      } catch (error: any) {
351 351
         // log the error and move on. other peers will sync us the scene.
352 352
         console.error(error);
353 353
       }

+ 1
- 1
src/excalidraw-app/collab/Portal.tsx View File

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

+ 2
- 2
src/excalidraw-app/collab/RoomDialog.tsx View File

@@ -53,7 +53,7 @@ const RoomDialog = ({
53 53
   const copyRoomLink = async () => {
54 54
     try {
55 55
       await copyTextToSystemClipboard(activeRoomLink);
56
-    } catch (error) {
56
+    } catch (error: any) {
57 57
       setErrorMessage(error.message);
58 58
     }
59 59
     if (roomLinkInput.current) {
@@ -68,7 +68,7 @@ const RoomDialog = ({
68 68
         text: t("roomDialog.shareTitle"),
69 69
         url: activeRoomLink,
70 70
       });
71
-    } catch (error) {
71
+    } catch (error: any) {
72 72
       // Just ignore.
73 73
     }
74 74
   };

+ 1
- 1
src/excalidraw-app/components/ExportToExcalidrawPlus.tsx View File

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

+ 3
- 3
src/excalidraw-app/data/firebase.ts View File

@@ -28,7 +28,7 @@ const _loadFirebase = async () => {
28 28
   if (!isFirebaseInitialized) {
29 29
     try {
30 30
       firebase.initializeApp(FIREBASE_CONFIG);
31
-    } catch (error) {
31
+    } catch (error: any) {
32 32
       // trying initialize again throws. Usually this is harmless, and happens
33 33
       // mainly in dev (HMR)
34 34
       if (error.code === "app/duplicate-app") {
@@ -172,7 +172,7 @@ export const saveFilesToFirebase = async ({
172 172
             },
173 173
           );
174 174
         savedFiles.set(id, true);
175
-      } catch (error) {
175
+      } catch (error: any) {
176 176
         erroredFiles.set(id, true);
177 177
       }
178 178
     }),
@@ -296,7 +296,7 @@ export const loadFilesFromFirebase = async (
296 296
         } else {
297 297
           erroredFiles.set(id, true);
298 298
         }
299
-      } catch (error) {
299
+      } catch (error: any) {
300 300
         erroredFiles.set(id, true);
301 301
         console.error(error);
302 302
       }

+ 4
- 4
src/excalidraw-app/data/index.ts View File

@@ -122,7 +122,7 @@ export const decryptAESGEM = async (
122 122
       new Uint8Array(decrypted),
123 123
     );
124 124
     return JSON.parse(decodedData);
125
-  } catch (error) {
125
+  } catch (error: any) {
126 126
     window.alert(t("alerts.decryptFailed"));
127 127
     console.error(error);
128 128
   }
@@ -198,7 +198,7 @@ const importFromBackend = async (
198 198
         const iv = buffer.slice(0, IV_LENGTH_BYTES);
199 199
         const encrypted = buffer.slice(IV_LENGTH_BYTES, buffer.byteLength);
200 200
         decrypted = await decryptImported(iv, encrypted, privateKey);
201
-      } catch (error) {
201
+      } catch (error: any) {
202 202
         // Fixed IV (old format, backward compatibility)
203 203
         const fixedIv = new Uint8Array(IV_LENGTH_BYTES);
204 204
         decrypted = await decryptImported(fixedIv, buffer, privateKey);
@@ -218,7 +218,7 @@ const importFromBackend = async (
218 218
       elements: data.elements || null,
219 219
       appState: data.appState || null,
220 220
     };
221
-  } catch (error) {
221
+  } catch (error: any) {
222 222
     window.alert(t("alerts.importBackendFailed"));
223 223
     console.error(error);
224 224
     return {};
@@ -333,7 +333,7 @@ export const exportToBackend = async (
333 333
     } else {
334 334
       window.alert(t("alerts.couldNotCreateShareableLink"));
335 335
     }
336
-  } catch (error) {
336
+  } catch (error: any) {
337 337
     console.error(error);
338 338
     window.alert(t("alerts.couldNotCreateShareableLink"));
339 339
   }

+ 8
- 8
src/excalidraw-app/data/localStorage.ts View File

@@ -20,7 +20,7 @@ export const saveUsernameToLocalStorage = (username: string) => {
20 20
       STORAGE_KEYS.LOCAL_STORAGE_COLLAB,
21 21
       JSON.stringify({ username }),
22 22
     );
23
-  } catch (error) {
23
+  } catch (error: any) {
24 24
     // Unable to access window.localStorage
25 25
     console.error(error);
26 26
   }
@@ -32,7 +32,7 @@ export const importUsernameFromLocalStorage = (): string | null => {
32 32
     if (data) {
33 33
       return JSON.parse(data).username;
34 34
     }
35
-  } catch (error) {
35
+  } catch (error: any) {
36 36
     // Unable to access localStorage
37 37
     console.error(error);
38 38
   }
@@ -53,7 +53,7 @@ export const saveToLocalStorage = (
53 53
       STORAGE_KEYS.LOCAL_STORAGE_APP_STATE,
54 54
       JSON.stringify(clearAppStateForLocalStorage(appState)),
55 55
     );
56
-  } catch (error) {
56
+  } catch (error: any) {
57 57
     // Unable to access window.localStorage
58 58
     console.error(error);
59 59
   }
@@ -66,7 +66,7 @@ export const importFromLocalStorage = () => {
66 66
   try {
67 67
     savedElements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS);
68 68
     savedState = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_APP_STATE);
69
-  } catch (error) {
69
+  } catch (error: any) {
70 70
     // Unable to access localStorage
71 71
     console.error(error);
72 72
   }
@@ -75,7 +75,7 @@ export const importFromLocalStorage = () => {
75 75
   if (savedElements) {
76 76
     try {
77 77
       elements = clearElementsForLocalStorage(JSON.parse(savedElements));
78
-    } catch (error) {
78
+    } catch (error: any) {
79 79
       console.error(error);
80 80
       // Do nothing because elements array is already empty
81 81
     }
@@ -90,7 +90,7 @@ export const importFromLocalStorage = () => {
90 90
           JSON.parse(savedState) as Partial<AppState>,
91 91
         ),
92 92
       };
93
-    } catch (error) {
93
+    } catch (error: any) {
94 94
       console.error(error);
95 95
       // Do nothing because appState is already null
96 96
     }
@@ -103,7 +103,7 @@ export const getElementsStorageSize = () => {
103 103
     const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS);
104 104
     const elementsSize = elements?.length || 0;
105 105
     return elementsSize;
106
-  } catch (error) {
106
+  } catch (error: any) {
107 107
     console.error(error);
108 108
     return 0;
109 109
   }
@@ -122,7 +122,7 @@ export const getTotalStorageSize = () => {
122 122
     const librarySize = library?.length || 0;
123 123
 
124 124
     return appStateSize + collabSize + librarySize + getElementsStorageSize();
125
-  } catch (error) {
125
+  } catch (error: any) {
126 126
     console.error(error);
127 127
     return 0;
128 128
   }

+ 5
- 5
src/excalidraw-app/index.tsx View File

@@ -109,7 +109,7 @@ const localFileStorage = new FileManager({
109 109
         try {
110 110
           await set(id, fileData, filesStore);
111 111
           savedFiles.set(id, true);
112
-        } catch (error) {
112
+        } catch (error: any) {
113 113
           console.error(error);
114 114
           erroredFiles.set(id, true);
115 115
         }
@@ -228,7 +228,7 @@ const initializeScene = async (opts: {
228 228
       ) {
229 229
         return { scene: data, isExternalScene };
230 230
       }
231
-    } catch (error) {
231
+    } catch (error: any) {
232 232
       return {
233 233
         scene: {
234 234
           appState: {
@@ -377,8 +377,8 @@ const ExcalidrawWrapper = () => {
377 377
           JSON.parse(
378 378
             localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_LIBRARY) as string,
379 379
           ) || [];
380
-      } catch (e) {
381
-        console.error(e);
380
+      } catch (error: any) {
381
+        console.error(error);
382 382
       }
383 383
     };
384 384
 
@@ -508,7 +508,7 @@ const ExcalidrawWrapper = () => {
508 508
           },
509 509
           files,
510 510
         );
511
-      } catch (error) {
511
+      } catch (error: any) {
512 512
         if (error.name !== "AbortError") {
513 513
           const { width, height } = canvas;
514 514
           console.error(error, { width, height });

+ 1
- 1
src/packages/excalidraw/package.json View File

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

+ 4
- 4
src/packages/excalidraw/yarn.lock View File

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

+ 3
- 3
src/renderer/renderScene.ts View File

@@ -274,7 +274,7 @@ export const renderScene = (
274 274
   visibleElements.forEach((element) => {
275 275
     try {
276 276
       renderElement(element, rc, context, renderOptimizations, sceneState);
277
-    } catch (error) {
277
+    } catch (error: any) {
278 278
       console.error(error);
279 279
     }
280 280
   });
@@ -298,7 +298,7 @@ export const renderScene = (
298 298
         renderOptimizations,
299 299
         sceneState,
300 300
       );
301
-    } catch (error) {
301
+    } catch (error: any) {
302 302
       console.error(error);
303 303
     }
304 304
   }
@@ -822,7 +822,7 @@ export const renderSceneToSvg = (
822 822
           element.x + offsetX,
823 823
           element.y + offsetY,
824 824
         );
825
-      } catch (error) {
825
+      } catch (error: any) {
826 826
         console.error(error);
827 827
       }
828 828
     }

+ 2
- 2
src/scene/export.ts View File

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

+ 1
- 1
src/tests/helpers/api.ts View File

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

+ 1
- 1
src/tests/reconciliation.test.ts View File

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

+ 1
- 1
tsconfig-types.json View File

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

+ 1
- 1
tsconfig.json View File

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

+ 43
- 41
yarn.lock View File

@@ -2435,6 +2435,11 @@
2435 2435
   dependencies:
2436 2436
     source-map "^0.6.1"
2437 2437
 
2438
+"@types/web@0.0.45":
2439
+  version "0.0.45"
2440
+  resolved "https://registry.yarnpkg.com/@types/web/-/web-0.0.45.tgz#835adbad37e3f6f13cb4708a93f9043af1345af4"
2441
+  integrity sha512-VbDWJoWuxfnqbOU5BYQWY6hF4lT20WrcwcBKf/DrdLS2s1mEywhPgqGp6ZazZnBlHmoyZVeEyZx/+9KylQV1vg==
2442
+
2438 2443
 "@types/webpack-sources@*":
2439 2444
   version "2.1.0"
2440 2445
   resolved "https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-2.1.0.tgz"
@@ -2540,39 +2545,23 @@
2540 2545
   resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.19.0.tgz"
2541 2546
   integrity sha512-A4iAlexVvd4IBsSTNxdvdepW0D4uR/fwxDrKUa+iEY9UWvGREu2ZyB8ylTENM1SH8F7bVC9ac9+si3LWNxcBuA==
2542 2547
 
2543
-"@typescript-eslint/typescript-estree@3.10.1":
2544
-  version "3.10.1"
2545
-  resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz"
2546
-  integrity sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w==
2547
-  dependencies:
2548
-    "@typescript-eslint/types" "3.10.1"
2549
-    "@typescript-eslint/visitor-keys" "3.10.1"
2550
-    debug "^4.1.1"
2551
-    glob "^7.1.6"
2552
-    is-glob "^4.0.1"
2553
-    lodash "^4.17.15"
2554
-    semver "^7.3.2"
2555
-    tsutils "^3.17.1"
2556
-
2557
-"@typescript-eslint/typescript-estree@4.19.0":
2558
-  version "4.19.0"
2559
-  resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.19.0.tgz"
2560
-  integrity sha512-3xqArJ/A62smaQYRv2ZFyTA+XxGGWmlDYrsfZG68zJeNbeqRScnhf81rUVa6QG4UgzHnXw5VnMT5cg75dQGDkA==
2561
-  dependencies:
2562
-    "@typescript-eslint/types" "4.19.0"
2563
-    "@typescript-eslint/visitor-keys" "4.19.0"
2564
-    debug "^4.1.1"
2565
-    globby "^11.0.1"
2566
-    is-glob "^4.0.1"
2567
-    semver "^7.3.2"
2568
-    tsutils "^3.17.1"
2548
+"@typescript-eslint/types@5.3.0":
2549
+  version "5.3.0"
2550
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.3.0.tgz#af29fd53867c2df0028c57c36a655bd7e9e05416"
2551
+  integrity sha512-fce5pG41/w8O6ahQEhXmMV+xuh4+GayzqEogN24EK+vECA3I6pUwKuLi5QbXO721EMitpQne5VKXofPonYlAQg==
2569 2552
 
2570
-"@typescript-eslint/visitor-keys@3.10.1":
2571
-  version "3.10.1"
2572
-  resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz"
2573
-  integrity sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ==
2553
+"@typescript-eslint/typescript-estree@3.10.1", "@typescript-eslint/typescript-estree@4.19.0", "@typescript-eslint/typescript-estree@5.3.0":
2554
+  version "5.3.0"
2555
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.3.0.tgz#4f68ddd46dc2983182402d2ab21fb44ad94988cf"
2556
+  integrity sha512-FJ0nqcaUOpn/6Z4Jwbtf+o0valjBLkqc3MWkMvrhA2TvzFXtcclIM8F4MBEmYa2kgcI8EZeSAzwoSrIC8JYkug==
2574 2557
   dependencies:
2575
-    eslint-visitor-keys "^1.1.0"
2558
+    "@typescript-eslint/types" "5.3.0"
2559
+    "@typescript-eslint/visitor-keys" "5.3.0"
2560
+    debug "^4.3.2"
2561
+    globby "^11.0.4"
2562
+    is-glob "^4.0.3"
2563
+    semver "^7.3.5"
2564
+    tsutils "^3.21.0"
2576 2565
 
2577 2566
 "@typescript-eslint/visitor-keys@4.19.0":
2578 2567
   version "4.19.0"
@@ -2582,6 +2571,14 @@
2582 2571
     "@typescript-eslint/types" "4.19.0"
2583 2572
     eslint-visitor-keys "^2.0.0"
2584 2573
 
2574
+"@typescript-eslint/visitor-keys@5.3.0":
2575
+  version "5.3.0"
2576
+  resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.3.0.tgz#a6258790f3b7b2547f70ed8d4a1e0c3499994523"
2577
+  integrity sha512-oVIAfIQuq0x2TFDNLVavUn548WL+7hdhxYn+9j3YdJJXB7mH9dAmZNJsPDa7Jc+B9WGqoiex7GUDbyMxV0a/aw==
2578
+  dependencies:
2579
+    "@typescript-eslint/types" "5.3.0"
2580
+    eslint-visitor-keys "^3.0.0"
2581
+
2585 2582
 "@webassemblyjs/ast@1.9.0":
2586 2583
   version "1.9.0"
2587 2584
   resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz"
@@ -6027,6 +6024,11 @@ eslint-visitor-keys@^2.0.0:
6027 6024
   resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz"
6028 6025
   integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==
6029 6026
 
6027
+eslint-visitor-keys@^3.0.0:
6028
+  version "3.0.0"
6029
+  resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz#e32e99c6cdc2eb063f204eda5db67bfe58bb4186"
6030
+  integrity sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q==
6031
+
6030 6032
 eslint-webpack-plugin@^2.5.2:
6031 6033
   version "2.5.2"
6032 6034
   resolved "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-2.5.2.tgz"
@@ -7175,9 +7177,9 @@ globby@11.0.1:
7175 7177
     merge2 "^1.3.0"
7176 7178
     slash "^3.0.0"
7177 7179
 
7178
-globby@^11.0.1:
7180
+globby@^11.0.4:
7179 7181
   version "11.0.4"
7180
-  resolved "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz"
7182
+  resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5"
7181 7183
   integrity sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==
7182 7184
   dependencies:
7183 7185
     array-union "^2.1.0"
@@ -8136,9 +8138,9 @@ is-glob@^3.1.0:
8136 8138
   dependencies:
8137 8139
     is-extglob "^2.1.0"
8138 8140
 
8139
-is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1:
8141
+is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1:
8140 8142
   version "4.0.3"
8141
-  resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz"
8143
+  resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084"
8142 8144
   integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==
8143 8145
   dependencies:
8144 8146
     is-extglob "^2.1.1"
@@ -14243,9 +14245,9 @@ tslib@^2.2.0:
14243 14245
   resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
14244 14246
   integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
14245 14247
 
14246
-tsutils@^3.17.1:
14248
+tsutils@^3.17.1, tsutils@^3.21.0:
14247 14249
   version "3.21.0"
14248
-  resolved "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz"
14250
+  resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"
14249 14251
   integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==
14250 14252
   dependencies:
14251 14253
     tslib "^1.8.1"
@@ -14359,10 +14361,10 @@ typedarray@^0.0.6:
14359 14361
   resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz"
14360 14362
   integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
14361 14363
 
14362
-typescript@4.2.4:
14363
-  version "4.2.4"
14364
-  resolved "https://registry.npmjs.org/typescript/-/typescript-4.2.4.tgz"
14365
-  integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==
14364
+typescript@4.4.4:
14365
+  version "4.4.4"
14366
+  resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c"
14367
+  integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==
14366 14368
 
14367 14369
 typeson-registry@^1.0.0-alpha.20:
14368 14370
   version "1.0.0-alpha.39"

Loading…
Cancel
Save