From d080833f4d359e808cd12acdc7dd1c9187c956e5 Mon Sep 17 00:00:00 2001 From: David Luzar <5153846+dwelle@users.noreply.github.com> Date: Mon, 1 Dec 2025 22:37:42 +0100 Subject: [PATCH] chore: bump typescript@5.9.3 (#10431) --- excalidraw-app/collab/Collab.tsx | 4 ++-- excalidraw-app/data/firebase.ts | 4 ++-- package.json | 2 +- packages/excalidraw/data/encode.ts | 12 ++++++------ packages/excalidraw/data/encryption.ts | 14 +++++++------- packages/excalidraw/global.d.ts | 2 +- packages/excalidraw/hooks/useOutsideClick.ts | 2 +- packages/excalidraw/package.json | 2 +- .../excalidraw/subset/harfbuzz/harfbuzz-loader.ts | 2 +- packages/excalidraw/subset/woff2/woff2-loader.ts | 6 +++--- packages/excalidraw/tests/helpers/api.ts | 2 +- packages/utils/package.json | 2 +- yarn.lock | 8 ++++---- 13 files changed, 31 insertions(+), 31 deletions(-) diff --git a/excalidraw-app/collab/Collab.tsx b/excalidraw-app/collab/Collab.tsx index 3c7e686d38..b17626a0e1 100644 --- a/excalidraw-app/collab/Collab.tsx +++ b/excalidraw-app/collab/Collab.tsx @@ -441,7 +441,7 @@ class Collab extends PureComponent { }; private decryptPayload = async ( - iv: Uint8Array, + iv: Uint8Array, encryptedData: ArrayBuffer, decryptionKey: string, ): Promise> => { @@ -562,7 +562,7 @@ class Collab extends PureComponent { // All socket listeners are moving to Portal this.portal.socket.on( "client-broadcast", - async (encryptedData: ArrayBuffer, iv: Uint8Array) => { + async (encryptedData: ArrayBuffer, iv: Uint8Array) => { if (!this.portal.roomKey) { return; } diff --git a/excalidraw-app/data/firebase.ts b/excalidraw-app/data/firebase.ts index 4e4c60b291..da25271ca6 100644 --- a/excalidraw-app/data/firebase.ts +++ b/excalidraw-app/data/firebase.ts @@ -105,8 +105,8 @@ const decryptElements = async ( data: FirebaseStoredScene, roomKey: string, ): Promise => { - const ciphertext = data.ciphertext.toUint8Array(); - const iv = data.iv.toUint8Array(); + const ciphertext = data.ciphertext.toUint8Array() as Uint8Array; + const iv = data.iv.toUint8Array() as Uint8Array; const decrypted = await decryptData(iv, ciphertext, roomKey); const decodedData = new TextDecoder("utf-8").decode( diff --git a/package.json b/package.json index 4a3febd4d0..65ff221a49 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "prettier": "2.6.2", "rewire": "6.0.0", "rimraf": "^5.0.0", - "typescript": "4.9.4", + "typescript": "5.9.3", "vite": "5.0.12", "vite-plugin-checker": "0.7.2", "vite-plugin-ejs": "1.7.0", diff --git a/packages/excalidraw/data/encode.ts b/packages/excalidraw/data/encode.ts index 31d7a5bc1a..e08c3f4f28 100644 --- a/packages/excalidraw/data/encode.ts +++ b/packages/excalidraw/data/encode.ts @@ -222,7 +222,7 @@ function dataView( * * @param buffers each buffer (chunk) must be at most 2^32 bits large (~4GB) */ -const concatBuffers = (...buffers: Uint8Array[]) => { +const concatBuffers = (...buffers: Uint8Array[]): Uint8Array => { const bufferView = new Uint8Array( VERSION_DATAVIEW_BYTES + NEXT_CHUNK_SIZE_DATAVIEW_BYTES * buffers.length + @@ -295,12 +295,12 @@ const splitBuffers = (concatenatedBuffer: Uint8Array) => { /** @private */ const _encryptAndCompress = async ( - data: Uint8Array | string, + data: Uint8Array | string, encryptionKey: string, ) => { const { encryptedBuffer, iv } = await encryptData( encryptionKey, - deflate(data), + deflate(data) as Uint8Array, ); return { iv, buffer: new Uint8Array(encryptedBuffer) }; @@ -330,7 +330,7 @@ export const compressData = async = never>( : { metadata: T; }), -): Promise => { +): Promise> => { const fileInfo: FileEncodingInfo = { version: 2, compression: "pako@1", @@ -355,8 +355,8 @@ export const compressData = async = never>( /** @private */ const _decryptAndDecompress = async ( - iv: Uint8Array, - decryptedBuffer: Uint8Array, + iv: Uint8Array, + decryptedBuffer: Uint8Array, decryptionKey: string, isCompressed: boolean, ) => { diff --git a/packages/excalidraw/data/encryption.ts b/packages/excalidraw/data/encryption.ts index ee1a88f351..d411884d3c 100644 --- a/packages/excalidraw/data/encryption.ts +++ b/packages/excalidraw/data/encryption.ts @@ -4,7 +4,7 @@ import { blobToArrayBuffer } from "./blob"; export const IV_LENGTH_BYTES = 12; -export const createIV = () => { +export const createIV = (): Uint8Array => { const arr = new Uint8Array(IV_LENGTH_BYTES); return window.crypto.getRandomValues(arr); }; @@ -49,12 +49,12 @@ export const getCryptoKey = (key: string, usage: KeyUsage) => export const encryptData = async ( key: string | CryptoKey, - data: Uint8Array | ArrayBuffer | Blob | File | string, -): Promise<{ encryptedBuffer: ArrayBuffer; iv: Uint8Array }> => { + data: Uint8Array | ArrayBuffer | Blob | File | string, +): Promise<{ encryptedBuffer: ArrayBuffer; iv: Uint8Array }> => { const importedKey = typeof key === "string" ? await getCryptoKey(key, "encrypt") : key; const iv = createIV(); - const buffer: ArrayBuffer | Uint8Array = + const buffer: ArrayBuffer | Uint8Array = typeof data === "string" ? new TextEncoder().encode(data) : data instanceof Uint8Array @@ -71,15 +71,15 @@ export const encryptData = async ( iv, }, importedKey, - buffer as ArrayBuffer | Uint8Array, + buffer, ); return { encryptedBuffer, iv }; }; export const decryptData = async ( - iv: Uint8Array, - encrypted: Uint8Array | ArrayBuffer, + iv: Uint8Array, + encrypted: Uint8Array | ArrayBuffer, privateKey: string, ): Promise => { const key = await getCryptoKey(privateKey, "decrypt"); diff --git a/packages/excalidraw/global.d.ts b/packages/excalidraw/global.d.ts index 4d6bbbb6c6..59157002da 100644 --- a/packages/excalidraw/global.d.ts +++ b/packages/excalidraw/global.d.ts @@ -42,7 +42,7 @@ declare module "png-chunk-text" { function decode(data: Uint8Array): { keyword: string; text: string }; } declare module "png-chunks-encode" { - function encode(chunks: TEXtChunk[]): Uint8Array; + function encode(chunks: TEXtChunk[]): Uint8Array; export = encode; } declare module "png-chunks-extract" { diff --git a/packages/excalidraw/hooks/useOutsideClick.ts b/packages/excalidraw/hooks/useOutsideClick.ts index 748eae9923..a9e5ce11cb 100644 --- a/packages/excalidraw/hooks/useOutsideClick.ts +++ b/packages/excalidraw/hooks/useOutsideClick.ts @@ -18,7 +18,7 @@ export function useOutsideClick( * Returning `undefined` will fallback to the default behavior. */ isInside?: ( - event: Event & { target: HTMLElement }, + event: Event & { target: T }, /** the element of the passed ref */ container: T, ) => boolean | undefined, diff --git a/packages/excalidraw/package.json b/packages/excalidraw/package.json index a5da2c3a31..5f3d6b2684 100644 --- a/packages/excalidraw/package.json +++ b/packages/excalidraw/package.json @@ -133,6 +133,6 @@ "fonteditor-core": "2.4.1", "harfbuzzjs": "0.3.6", "jest-diff": "29.7.0", - "typescript": "4.9.4" + "typescript": "5.9.3" } } diff --git a/packages/excalidraw/subset/harfbuzz/harfbuzz-loader.ts b/packages/excalidraw/subset/harfbuzz/harfbuzz-loader.ts index 120dedb7fc..1af06469f6 100644 --- a/packages/excalidraw/subset/harfbuzz/harfbuzz-loader.ts +++ b/packages/excalidraw/subset/harfbuzz/harfbuzz-loader.ts @@ -20,7 +20,7 @@ const load = (): Promise<{ subset: ( fontBuffer: ArrayBuffer, codePoints: ReadonlySet, - ) => Uint8Array; + ) => Uint8Array; }> => { return new Promise(async (resolve, reject) => { try { diff --git a/packages/excalidraw/subset/woff2/woff2-loader.ts b/packages/excalidraw/subset/woff2/woff2-loader.ts index 7d5de30958..b851dcb66d 100644 --- a/packages/excalidraw/subset/woff2/woff2-loader.ts +++ b/packages/excalidraw/subset/woff2/woff2-loader.ts @@ -18,7 +18,7 @@ type Vector = any; let loadedWasm: ReturnType | null = null; // re-map from internal vector into byte array -function convertFromVecToUint8Array(vector: Vector): Uint8Array { +function convertFromVecToUint8Array(vector: Vector): Uint8Array { const arr = []; for (let i = 0, l = vector.size(); i < l; i++) { arr.push(vector.get(i)); @@ -29,8 +29,8 @@ function convertFromVecToUint8Array(vector: Vector): Uint8Array { // TODO: consider adding support for fetching the wasm from an URL (external CDN, data URL, etc.) const load = (): Promise<{ - compress: (buffer: ArrayBuffer) => Uint8Array; - decompress: (buffer: ArrayBuffer) => Uint8Array; + compress: (buffer: ArrayBuffer) => Uint8Array; + decompress: (buffer: ArrayBuffer) => Uint8Array; }> => { return new Promise((resolve, reject) => { try { diff --git a/packages/excalidraw/tests/helpers/api.ts b/packages/excalidraw/tests/helpers/api.ts index 68b0813160..b4dc353ff1 100644 --- a/packages/excalidraw/tests/helpers/api.ts +++ b/packages/excalidraw/tests/helpers/api.ts @@ -464,7 +464,7 @@ export class API { static readFile = async ( filepath: string, encoding?: T, - ): Promise => { + ): Promise => { filepath = path.isAbsolute(filepath) ? filepath : path.resolve(path.join(__dirname, "../", filepath)); diff --git a/packages/utils/package.json b/packages/utils/package.json index 6dc400c65c..ed4d6dd274 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -62,7 +62,7 @@ "devDependencies": { "cross-env": "7.0.3", "fonteditor-core": "2.4.0", - "typescript": "4.9.4", + "typescript": "5.9.3", "wawoff2": "2.0.1", "which": "4.0.0" }, diff --git a/yarn.lock b/yarn.lock index 446297a280..edd96b0405 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9290,10 +9290,10 @@ typed-array-length@^1.0.7: possible-typed-array-names "^1.0.0" reflect.getprototypeof "^1.0.6" -typescript@4.9.4: - version "4.9.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.4.tgz#a2a3d2756c079abda241d75f149df9d561091e78" - integrity sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg== +typescript@5.9.3: + version "5.9.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f" + integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw== typescript@^5: version "5.8.2"