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

@ -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;

View file

@ -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,

View file

@ -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");
}

View file

@ -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;
}

View file

@ -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;
}