diff options
author | James Maa <jmaa@berkeley.edu> | 2024-05-09 15:42:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-09 07:42:35 +0000 |
commit | 13278a5cf67de69678d8c4c5fb97e6eb00c94c11 (patch) | |
tree | 1d77bcf97bb9c6f08c88c9f80ea0da735d5721c2 /ext/js/pages/settings | |
parent | 77fa1d0f64b66d6e4fe9c8795c7844206edbcaf2 (diff) |
Update eslint unsafe rule (#887)
* Enable @typescript-eslint/no-unsafe-assignment
* Updates
* Add missing import
* Updates
* Fix types?
* Fix tests
* Address comments
* Move TextProcessorVariant to types
* Update types/ext/translation-internal.d.ts
Co-authored-by: StefanVukovic99 <stefanvukovic44@gmail.com>
Signed-off-by: James Maa <jmaa@berkeley.edu>
---------
Signed-off-by: James Maa <jmaa@berkeley.edu>
Co-authored-by: toasted-nutbread <toasted-nutbread@users.noreply.github.com>
Co-authored-by: StefanVukovic99 <stefanvukovic44@gmail.com>
Diffstat (limited to 'ext/js/pages/settings')
-rw-r--r-- | ext/js/pages/settings/backup-controller.js | 10 | ||||
-rw-r--r-- | ext/js/pages/settings/dictionary-import-controller.js | 1 |
2 files changed, 8 insertions, 3 deletions
diff --git a/ext/js/pages/settings/backup-controller.js b/ext/js/pages/settings/backup-controller.js index 5c168849..f0876d3f 100644 --- a/ext/js/pages/settings/backup-controller.js +++ b/ext/js/pages/settings/backup-controller.js @@ -574,12 +574,16 @@ export class BackupController { * @returns {Promise<Blob>} */ async _exportDatabase(databaseName) { - const db = await new Dexie(databaseName).open(); + const DexieConstructor = /** @type {import('dexie').DexieConstructor} */ (/** @type {unknown} */ (Dexie)); + const db = new DexieConstructor(databaseName); + await db.open(); + /** @type {unknown} */ + // @ts-expect-error - The export function is declared as an extension which has no type information. const blob = await db.export({ progressCallback: this._databaseExportProgressCallback.bind(this) }); - await db.close(); - return blob; + db.close(); + return /** @type {Blob} */ (blob); } /** */ diff --git a/ext/js/pages/settings/dictionary-import-controller.js b/ext/js/pages/settings/dictionary-import-controller.js index f63eb49e..ecfadc1f 100644 --- a/ext/js/pages/settings/dictionary-import-controller.js +++ b/ext/js/pages/settings/dictionary-import-controller.js @@ -306,6 +306,7 @@ export class DictionaryImportController { * @param {Error[]} errors */ _showErrors(errors) { + /** @type {Map<string, number>} */ const uniqueErrors = new Map(); for (const error of errors) { log.error(error); |