From f5b45e0f1f80a775a93cf60ee92e933bd77ee7f7 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 11 Dec 2024 12:49:10 +0000 Subject: [PATCH] Fix lint errors --- spec/integ/crypto/crypto.spec.ts | 4 ++-- spec/integ/crypto/megolm-backup.spec.ts | 2 +- spec/test-utils/mockEndpoints.ts | 2 +- src/client.ts | 2 +- src/crypto/store/indexeddb-crypto-store-backend.ts | 2 +- src/store/indexeddb-local-backend.ts | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/integ/crypto/crypto.spec.ts b/spec/integ/crypto/crypto.spec.ts index 96d809aea9..af1142dfe0 100644 --- a/spec/integ/crypto/crypto.spec.ts +++ b/spec/integ/crypto/crypto.spec.ts @@ -3142,7 +3142,7 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("crypto (%s)", (backend: string, fetchMock.put( "path:/_matrix/client/v3/room_keys/keys", (url, request) => { - const uploadPayload: KeyBackup = JSON.parse(request.body?.toString() ?? "{}"); + const uploadPayload: KeyBackup = JSON.parse((request.body as string) ?? "{}"); resolve(uploadPayload); return { status: 200, @@ -3209,7 +3209,7 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("crypto (%s)", (backend: string, fetchMock.post( "path:/_matrix/client/v3/room_keys/version", (url, request) => { - const backupData: KeyBackupInfo = JSON.parse(request.body?.toString() ?? "{}"); + const backupData: KeyBackupInfo = JSON.parse((request.body as string) ?? "{}"); backupData.version = newVersion; backupData.count = 0; backupData.etag = "zer"; diff --git a/spec/integ/crypto/megolm-backup.spec.ts b/spec/integ/crypto/megolm-backup.spec.ts index 05b5ff27b6..eff0ff567e 100644 --- a/spec/integ/crypto/megolm-backup.spec.ts +++ b/spec/integ/crypto/megolm-backup.spec.ts @@ -91,7 +91,7 @@ function mockUploadEmitter( }, }; } - const uploadPayload: KeyBackup = JSON.parse(request.body?.toString() ?? "{}"); + const uploadPayload: KeyBackup = JSON.parse((request.body as string) ?? "{}"); let count = 0; for (const [roomId, value] of Object.entries(uploadPayload.rooms)) { for (const sessionId of Object.keys(value.sessions)) { diff --git a/spec/test-utils/mockEndpoints.ts b/spec/test-utils/mockEndpoints.ts index 988d6f13b6..7c16583885 100644 --- a/spec/test-utils/mockEndpoints.ts +++ b/spec/test-utils/mockEndpoints.ts @@ -88,7 +88,7 @@ export function mockSetupMegolmBackupRequests(backupVersion: string): void { }); fetchMock.post("path:/_matrix/client/v3/room_keys/version", (url, request) => { - const backupData: KeyBackupInfo = JSON.parse(request.body?.toString() ?? "{}"); + const backupData: KeyBackupInfo = JSON.parse((request.body as string) ?? "{}"); backupData.version = backupVersion; backupData.count = 0; backupData.etag = "zer"; diff --git a/src/client.ts b/src/client.ts index 2de41f2ca2..54f5309428 100644 --- a/src/client.ts +++ b/src/client.ts @@ -5065,7 +5065,7 @@ export class MatrixClient extends TypedEventEmitter( return new Promise((resolve, reject) => { const results: T[] = []; query.onerror = (): void => { - reject(new Error("Query failed: " + query.error)); + reject(new Error("Query failed: " + query.error?.name)); }; // collect results query.onsuccess = (): void => { @@ -360,7 +360,7 @@ export class LocalIndexedDBStoreBackend implements IIndexedDBBackend { // in firefox, with indexedDB disabled, this fails with a // DOMError. We treat this as non-fatal, so that we can still // use the app. - logger.warn(`unable to delete js-sdk store indexeddb: ${req.error}`); + logger.warn(`unable to delete js-sdk store indexeddb: ${req.error?.name}`); resolve(); };