diff --git a/src/background.ts b/src/background.ts index 9e4e99450..4e3c11744 100644 --- a/src/background.ts +++ b/src/background.ts @@ -185,7 +185,7 @@ async function getTotp(text: string, silent = false) { try { label = decodeURIComponent(label); - } catch (error) { + } catch (error: any) { console.error(error); } if (label.indexOf(":") !== -1) { @@ -411,7 +411,7 @@ function getBackupToken(service: string) { localStorage.driveRefreshToken = res.refresh_token; resolve(true); } - } catch (error) { + } catch (error: any) { console.error(error); reject(error); } @@ -453,7 +453,7 @@ function getBackupToken(service: string) { res.refresh_token; resolve(true); } - } catch (error) { + } catch (error: any) { console.error(error); reject(error); } @@ -530,7 +530,7 @@ chrome.runtime.onInstalled.addListener(async (details) => { chrome.commands.onCommand.addListener(async (command: string) => { switch (command) { case "scan-qr": - await new Promise( + await new Promise( (resolve: () => void, reject: (reason: Error) => void) => { try { return chrome.tabs.executeScript( @@ -539,7 +539,7 @@ chrome.commands.onCommand.addListener(async (command: string) => { chrome.tabs.insertCSS({ file: "/css/content.css" }, resolve); } ); - } catch (error) { + } catch (error: any) { console.error(error); return reject(error); } diff --git a/src/models/backup.ts b/src/models/backup.ts index 70e64f44d..5a710bef4 100644 --- a/src/models/backup.ts +++ b/src/models/backup.ts @@ -51,14 +51,14 @@ export class Dropbox implements BackupProvider { } else { resolve(false); } - } catch (error) { + } catch (error: any) { reject(error); } } return; }; xhr.send(backup); - } catch (error) { + } catch (error: any) { return reject(error); } } @@ -141,7 +141,7 @@ export class Drive implements BackupProvider { } else { resolve(false); } - } catch (error) { + } catch (error: any) { console.error(error); reject(error); } @@ -216,7 +216,7 @@ export class Drive implements BackupProvider { localStorage.driveToken = res.access_token; resolve(true); } - } catch (error) { + } catch (error: any) { console.error(error); reject(error); } @@ -271,7 +271,7 @@ export class Drive implements BackupProvider { } else { resolve(true); } - } catch (error) { + } catch (error: any) { console.error(error); reject(error); } @@ -309,7 +309,7 @@ export class Drive implements BackupProvider { console.error(res.error.message); resolve(false); } - } catch (error) { + } catch (error: any) { console.error(error); reject(error); } @@ -374,7 +374,7 @@ export class Drive implements BackupProvider { console.error(res.error.message); resolve(false); } - } catch (error) { + } catch (error: any) { reject(error); } } @@ -400,7 +400,7 @@ export class Drive implements BackupProvider { requestData = requestData + line + "\n"; }); xhr.send(requestData); - } catch (error) { + } catch (error: any) { return reject(error); } } @@ -478,7 +478,7 @@ export class OneDrive implements BackupProvider { } else { resolve(false); } - } catch (error) { + } catch (error: any) { console.error(error); reject(error); } @@ -526,7 +526,7 @@ export class OneDrive implements BackupProvider { localStorage.oneDriveToken = res.access_token; resolve(true); } - } catch (error) { + } catch (error: any) { console.error(error); reject(error); } @@ -589,14 +589,14 @@ export class OneDrive implements BackupProvider { console.error(res.error.message); resolve(false); } - } catch (error) { + } catch (error: any) { reject(error); } } return; }; xhr.send(backup); - } catch (error) { + } catch (error: any) { return reject(error); } } diff --git a/src/models/storage.ts b/src/models/storage.ts index 4571958fd..3e701d8ed 100644 --- a/src/models/storage.ts +++ b/src/models/storage.ts @@ -124,7 +124,7 @@ export class BrowserStorage { // https://github.com/Authenticator-Extension/Authenticator/issues/412 static async clearLogs() { const storageLocation = await this.getStorageLocation(); - await new Promise((resolve: () => void) => { + await new Promise((resolve: () => void) => { if (storageLocation === "local") { chrome.storage.local.get((data) => { chrome.storage.local.clear(() => { @@ -366,7 +366,7 @@ export class EntryStorage { return resolve(_data); }); return; - } catch (error) { + } catch (error: any) { return reject(error); } } @@ -374,7 +374,7 @@ export class EntryStorage { } static import(encryption: Encryption, data: { [hash: string]: OTPStorage }) { - return new Promise( + return new Promise( (resolve: () => void, reject: (reason: Error) => void) => { try { BrowserStorage.get(async (_data: { [hash: string]: OTPStorage }) => { @@ -479,7 +479,7 @@ export class EntryStorage { BrowserStorage.set(_data, resolve); }); return; - } catch (error) { + } catch (error: any) { return reject(error); } } @@ -487,14 +487,14 @@ export class EntryStorage { } static add(entry: OTPEntry) { - return new Promise( + return new Promise( (resolve: () => void, reject: (reason: Error) => void) => { try { BrowserStorage.set( { [entry.hash]: this.getOTPStorageFromEntry(entry) }, resolve ); - } catch (error) { + } catch (error: any) { reject(error); } } @@ -502,7 +502,7 @@ export class EntryStorage { } static update(entry: OTPEntry) { - return new Promise( + return new Promise( (resolve: () => void, reject: (reason: Error) => void) => { try { BrowserStorage.get((_data: { [hash: string]: OTPStorage }) => { @@ -515,7 +515,7 @@ export class EntryStorage { BrowserStorage.set(_data, resolve); }); return; - } catch (error) { + } catch (error: any) { return reject(error); } } @@ -523,7 +523,7 @@ export class EntryStorage { } static set(entries: OTPEntry[]) { - return new Promise( + return new Promise( (resolve: () => void, reject: (reason: Error) => void) => { try { BrowserStorage.get((_data: { [hash: string]: OTPStorage }) => { @@ -535,7 +535,7 @@ export class EntryStorage { BrowserStorage.set(_data, resolve); }); return; - } catch (error) { + } catch (error: any) { reject(error); } } @@ -619,7 +619,7 @@ export class EntryStorage { return resolve(data); }); return; - } catch (error) { + } catch (error: any) { return reject(error); } } @@ -627,13 +627,13 @@ export class EntryStorage { } static remove(hash: string) { - return new Promise((resolve: () => void) => { + return new Promise((resolve: () => void) => { return BrowserStorage.remove(hash, resolve); }); } static delete(entry: OTPEntry) { - return new Promise( + return new Promise( (resolve: () => void, reject: (reason: Error) => void) => { try { BrowserStorage.get((_data: { [hash: string]: OTPStorage }) => { @@ -647,7 +647,7 @@ export class EntryStorage { return; }); return; - } catch (error) { + } catch (error: any) { return reject(error); } } diff --git a/src/popup.ts b/src/popup.ts index 11cf51f12..268712e2c 100644 --- a/src/popup.ts +++ b/src/popup.ts @@ -339,7 +339,7 @@ export function syncTimeWithGoogle() { } }; xhr.send(); - } catch (error) { + } catch (error: any) { return reject(error); } } diff --git a/src/store/Accounts.ts b/src/store/Accounts.ts index f74d1d198..7dc248e2e 100644 --- a/src/store/Accounts.ts +++ b/src/store/Accounts.ts @@ -257,7 +257,7 @@ export class Accounts implements Module { key: { enc: encKey, hash: encKeyHash }, }); await EntryStorage.set(state.state.entries); - await new Promise((resolve) => { + await new Promise((resolve) => { BrowserStorage.remove(oldKeys, () => { resolve(); }); @@ -377,7 +377,7 @@ export class Accounts implements Module { }); await EntryStorage.set(state.state.entries); if (removeHashes.length) { - await new Promise((resolve) => { + await new Promise((resolve) => { BrowserStorage.remove(removeHashes, () => { resolve(); }); diff --git a/src/store/i18n.ts b/src/store/i18n.ts index 8c8df710a..68cd62f1f 100644 --- a/src/store/i18n.ts +++ b/src/store/i18n.ts @@ -20,7 +20,7 @@ export async function loadI18nMessages() { }; xhr.open("GET", chrome.extension.getURL("/_locales/en/messages.json")); xhr.send(); - } catch (error) { + } catch (error: any) { return reject(error); } }