chore: bump typescript@5.9.3 (#10431)

This commit is contained in:
David Luzar
2025-12-01 22:37:42 +01:00
committed by GitHub
parent 451bcac0b7
commit d080833f4d
13 changed files with 31 additions and 31 deletions

View File

@@ -441,7 +441,7 @@ class Collab extends PureComponent<CollabProps, CollabState> {
}; };
private decryptPayload = async ( private decryptPayload = async (
iv: Uint8Array, iv: Uint8Array<ArrayBuffer>,
encryptedData: ArrayBuffer, encryptedData: ArrayBuffer,
decryptionKey: string, decryptionKey: string,
): Promise<ValueOf<SocketUpdateDataSource>> => { ): Promise<ValueOf<SocketUpdateDataSource>> => {
@@ -562,7 +562,7 @@ class Collab extends PureComponent<CollabProps, CollabState> {
// All socket listeners are moving to Portal // All socket listeners are moving to Portal
this.portal.socket.on( this.portal.socket.on(
"client-broadcast", "client-broadcast",
async (encryptedData: ArrayBuffer, iv: Uint8Array) => { async (encryptedData: ArrayBuffer, iv: Uint8Array<ArrayBuffer>) => {
if (!this.portal.roomKey) { if (!this.portal.roomKey) {
return; return;
} }

View File

@@ -105,8 +105,8 @@ const decryptElements = async (
data: FirebaseStoredScene, data: FirebaseStoredScene,
roomKey: string, roomKey: string,
): Promise<readonly ExcalidrawElement[]> => { ): Promise<readonly ExcalidrawElement[]> => {
const ciphertext = data.ciphertext.toUint8Array(); const ciphertext = data.ciphertext.toUint8Array() as Uint8Array<ArrayBuffer>;
const iv = data.iv.toUint8Array(); const iv = data.iv.toUint8Array() as Uint8Array<ArrayBuffer>;
const decrypted = await decryptData(iv, ciphertext, roomKey); const decrypted = await decryptData(iv, ciphertext, roomKey);
const decodedData = new TextDecoder("utf-8").decode( const decodedData = new TextDecoder("utf-8").decode(

View File

@@ -34,7 +34,7 @@
"prettier": "2.6.2", "prettier": "2.6.2",
"rewire": "6.0.0", "rewire": "6.0.0",
"rimraf": "^5.0.0", "rimraf": "^5.0.0",
"typescript": "4.9.4", "typescript": "5.9.3",
"vite": "5.0.12", "vite": "5.0.12",
"vite-plugin-checker": "0.7.2", "vite-plugin-checker": "0.7.2",
"vite-plugin-ejs": "1.7.0", "vite-plugin-ejs": "1.7.0",

View File

@@ -222,7 +222,7 @@ function dataView(
* *
* @param buffers each buffer (chunk) must be at most 2^32 bits large (~4GB) * @param buffers each buffer (chunk) must be at most 2^32 bits large (~4GB)
*/ */
const concatBuffers = (...buffers: Uint8Array[]) => { const concatBuffers = (...buffers: Uint8Array[]): Uint8Array<ArrayBuffer> => {
const bufferView = new Uint8Array( const bufferView = new Uint8Array(
VERSION_DATAVIEW_BYTES + VERSION_DATAVIEW_BYTES +
NEXT_CHUNK_SIZE_DATAVIEW_BYTES * buffers.length + NEXT_CHUNK_SIZE_DATAVIEW_BYTES * buffers.length +
@@ -295,12 +295,12 @@ const splitBuffers = (concatenatedBuffer: Uint8Array) => {
/** @private */ /** @private */
const _encryptAndCompress = async ( const _encryptAndCompress = async (
data: Uint8Array | string, data: Uint8Array<ArrayBuffer> | string,
encryptionKey: string, encryptionKey: string,
) => { ) => {
const { encryptedBuffer, iv } = await encryptData( const { encryptedBuffer, iv } = await encryptData(
encryptionKey, encryptionKey,
deflate(data), deflate(data) as Uint8Array<ArrayBuffer>,
); );
return { iv, buffer: new Uint8Array(encryptedBuffer) }; return { iv, buffer: new Uint8Array(encryptedBuffer) };
@@ -330,7 +330,7 @@ export const compressData = async <T extends Record<string, any> = never>(
: { : {
metadata: T; metadata: T;
}), }),
): Promise<Uint8Array> => { ): Promise<Uint8Array<ArrayBuffer>> => {
const fileInfo: FileEncodingInfo = { const fileInfo: FileEncodingInfo = {
version: 2, version: 2,
compression: "pako@1", compression: "pako@1",
@@ -355,8 +355,8 @@ export const compressData = async <T extends Record<string, any> = never>(
/** @private */ /** @private */
const _decryptAndDecompress = async ( const _decryptAndDecompress = async (
iv: Uint8Array, iv: Uint8Array<ArrayBuffer>,
decryptedBuffer: Uint8Array, decryptedBuffer: Uint8Array<ArrayBuffer>,
decryptionKey: string, decryptionKey: string,
isCompressed: boolean, isCompressed: boolean,
) => { ) => {

View File

@@ -4,7 +4,7 @@ import { blobToArrayBuffer } from "./blob";
export const IV_LENGTH_BYTES = 12; export const IV_LENGTH_BYTES = 12;
export const createIV = () => { export const createIV = (): Uint8Array<ArrayBuffer> => {
const arr = new Uint8Array(IV_LENGTH_BYTES); const arr = new Uint8Array(IV_LENGTH_BYTES);
return window.crypto.getRandomValues(arr); return window.crypto.getRandomValues(arr);
}; };
@@ -49,12 +49,12 @@ export const getCryptoKey = (key: string, usage: KeyUsage) =>
export const encryptData = async ( export const encryptData = async (
key: string | CryptoKey, key: string | CryptoKey,
data: Uint8Array | ArrayBuffer | Blob | File | string, data: Uint8Array<ArrayBuffer> | ArrayBuffer | Blob | File | string,
): Promise<{ encryptedBuffer: ArrayBuffer; iv: Uint8Array }> => { ): Promise<{ encryptedBuffer: ArrayBuffer; iv: Uint8Array<ArrayBuffer> }> => {
const importedKey = const importedKey =
typeof key === "string" ? await getCryptoKey(key, "encrypt") : key; typeof key === "string" ? await getCryptoKey(key, "encrypt") : key;
const iv = createIV(); const iv = createIV();
const buffer: ArrayBuffer | Uint8Array = const buffer: ArrayBuffer | Uint8Array<ArrayBuffer> =
typeof data === "string" typeof data === "string"
? new TextEncoder().encode(data) ? new TextEncoder().encode(data)
: data instanceof Uint8Array : data instanceof Uint8Array
@@ -71,15 +71,15 @@ export const encryptData = async (
iv, iv,
}, },
importedKey, importedKey,
buffer as ArrayBuffer | Uint8Array, buffer,
); );
return { encryptedBuffer, iv }; return { encryptedBuffer, iv };
}; };
export const decryptData = async ( export const decryptData = async (
iv: Uint8Array, iv: Uint8Array<ArrayBuffer>,
encrypted: Uint8Array | ArrayBuffer, encrypted: Uint8Array<ArrayBuffer> | ArrayBuffer,
privateKey: string, privateKey: string,
): Promise<ArrayBuffer> => { ): Promise<ArrayBuffer> => {
const key = await getCryptoKey(privateKey, "decrypt"); const key = await getCryptoKey(privateKey, "decrypt");

View File

@@ -42,7 +42,7 @@ declare module "png-chunk-text" {
function decode(data: Uint8Array): { keyword: string; text: string }; function decode(data: Uint8Array): { keyword: string; text: string };
} }
declare module "png-chunks-encode" { declare module "png-chunks-encode" {
function encode(chunks: TEXtChunk[]): Uint8Array; function encode(chunks: TEXtChunk[]): Uint8Array<ArrayBuffer>;
export = encode; export = encode;
} }
declare module "png-chunks-extract" { declare module "png-chunks-extract" {

View File

@@ -18,7 +18,7 @@ export function useOutsideClick<T extends HTMLElement>(
* Returning `undefined` will fallback to the default behavior. * Returning `undefined` will fallback to the default behavior.
*/ */
isInside?: ( isInside?: (
event: Event & { target: HTMLElement }, event: Event & { target: T },
/** the element of the passed ref */ /** the element of the passed ref */
container: T, container: T,
) => boolean | undefined, ) => boolean | undefined,

View File

@@ -133,6 +133,6 @@
"fonteditor-core": "2.4.1", "fonteditor-core": "2.4.1",
"harfbuzzjs": "0.3.6", "harfbuzzjs": "0.3.6",
"jest-diff": "29.7.0", "jest-diff": "29.7.0",
"typescript": "4.9.4" "typescript": "5.9.3"
} }
} }

View File

@@ -20,7 +20,7 @@ const load = (): Promise<{
subset: ( subset: (
fontBuffer: ArrayBuffer, fontBuffer: ArrayBuffer,
codePoints: ReadonlySet<number>, codePoints: ReadonlySet<number>,
) => Uint8Array; ) => Uint8Array<ArrayBuffer>;
}> => { }> => {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {

View File

@@ -18,7 +18,7 @@ type Vector = any;
let loadedWasm: ReturnType<typeof load> | null = null; let loadedWasm: ReturnType<typeof load> | null = null;
// re-map from internal vector into byte array // re-map from internal vector into byte array
function convertFromVecToUint8Array(vector: Vector): Uint8Array { function convertFromVecToUint8Array(vector: Vector): Uint8Array<ArrayBuffer> {
const arr = []; const arr = [];
for (let i = 0, l = vector.size(); i < l; i++) { for (let i = 0, l = vector.size(); i < l; i++) {
arr.push(vector.get(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.) // TODO: consider adding support for fetching the wasm from an URL (external CDN, data URL, etc.)
const load = (): Promise<{ const load = (): Promise<{
compress: (buffer: ArrayBuffer) => Uint8Array; compress: (buffer: ArrayBuffer) => Uint8Array<ArrayBuffer>;
decompress: (buffer: ArrayBuffer) => Uint8Array; decompress: (buffer: ArrayBuffer) => Uint8Array<ArrayBuffer>;
}> => { }> => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {

View File

@@ -464,7 +464,7 @@ export class API {
static readFile = async <T extends "utf8" | null>( static readFile = async <T extends "utf8" | null>(
filepath: string, filepath: string,
encoding?: T, encoding?: T,
): Promise<T extends "utf8" ? string : Buffer> => { ): Promise<T extends "utf8" ? string : ArrayBuffer> => {
filepath = path.isAbsolute(filepath) filepath = path.isAbsolute(filepath)
? filepath ? filepath
: path.resolve(path.join(__dirname, "../", filepath)); : path.resolve(path.join(__dirname, "../", filepath));

View File

@@ -62,7 +62,7 @@
"devDependencies": { "devDependencies": {
"cross-env": "7.0.3", "cross-env": "7.0.3",
"fonteditor-core": "2.4.0", "fonteditor-core": "2.4.0",
"typescript": "4.9.4", "typescript": "5.9.3",
"wawoff2": "2.0.1", "wawoff2": "2.0.1",
"which": "4.0.0" "which": "4.0.0"
}, },

View File

@@ -9290,10 +9290,10 @@ typed-array-length@^1.0.7:
possible-typed-array-names "^1.0.0" possible-typed-array-names "^1.0.0"
reflect.getprototypeof "^1.0.6" reflect.getprototypeof "^1.0.6"
typescript@4.9.4: typescript@5.9.3:
version "4.9.4" version "5.9.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.4.tgz#a2a3d2756c079abda241d75f149df9d561091e78" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.9.3.tgz#5b4f59e15310ab17a216f5d6cf53ee476ede670f"
integrity sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg== integrity sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==
typescript@^5: typescript@^5:
version "5.8.2" version "5.8.2"