aboutsummaryrefslogtreecommitdiff
path: root/ext/js/language
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-27 14:55:27 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-11-27 14:55:27 -0500
commit7aed9a371b0d74c0d75179a08068e8935b76d780 (patch)
tree2d895b20e31cb03c8200e4429d987c6d253b1da7 /ext/js/language
parent5dc16745468c229e7c31f6cddaad83fb9c36b98f (diff)
Update types
Diffstat (limited to 'ext/js/language')
-rw-r--r--ext/js/language/__mocks__/dictionary-importer-media-loader.js1
-rw-r--r--ext/js/language/dictionary-importer.js2
-rw-r--r--ext/js/language/dictionary-worker.js2
-rw-r--r--ext/js/language/sandbox/japanese-util.js8
-rw-r--r--ext/js/language/text-scanner.js1
-rw-r--r--ext/js/language/translator.js4
6 files changed, 11 insertions, 7 deletions
diff --git a/ext/js/language/__mocks__/dictionary-importer-media-loader.js b/ext/js/language/__mocks__/dictionary-importer-media-loader.js
index 96f0f6dd..ffda29b3 100644
--- a/ext/js/language/__mocks__/dictionary-importer-media-loader.js
+++ b/ext/js/language/__mocks__/dictionary-importer-media-loader.js
@@ -17,6 +17,7 @@
*/
export class DictionaryImporterMediaLoader {
+ /** @type {import('dictionary-importer-media-loader').GetImageDetailsFunction} */
async getImageDetails(content) {
// Placeholder values
return {content, width: 100, height: 100};
diff --git a/ext/js/language/dictionary-importer.js b/ext/js/language/dictionary-importer.js
index aa6d7ae6..2a2f4063 100644
--- a/ext/js/language/dictionary-importer.js
+++ b/ext/js/language/dictionary-importer.js
@@ -36,7 +36,7 @@ export class DictionaryImporter {
}
/**
- * @param {DictionaryDatabase} dictionaryDatabase
+ * @param {import('./dictionary-database.js').DictionaryDatabase} dictionaryDatabase
* @param {ArrayBuffer} archiveContent
* @param {import('dictionary-importer').ImportDetails} details
* @returns {Promise<import('dictionary-importer').ImportResult>}
diff --git a/ext/js/language/dictionary-worker.js b/ext/js/language/dictionary-worker.js
index 3e78a6ff..3119dd7b 100644
--- a/ext/js/language/dictionary-worker.js
+++ b/ext/js/language/dictionary-worker.js
@@ -157,6 +157,8 @@ export class DictionaryWorker {
resolve(result2);
} else {
// If formatResult is not provided, the response is assumed to be the same type
+ // For some reason, eslint thinks the TResponse type is undefined
+ // eslint-disable-next-line jsdoc/no-undefined-types
resolve(/** @type {TResponse} */ (/** @type {unknown} */ (result)));
}
}
diff --git a/ext/js/language/sandbox/japanese-util.js b/ext/js/language/sandbox/japanese-util.js
index f7f20b3b..4c9c46bd 100644
--- a/ext/js/language/sandbox/japanese-util.js
+++ b/ext/js/language/sandbox/japanese-util.js
@@ -466,7 +466,7 @@ export class JapaneseUtil {
/**
* @param {string} text
- * @param {?TextSourceMap} [sourceMap]
+ * @param {?import('../../general/text-source-map.js').TextSourceMap} [sourceMap]
* @returns {string}
*/
convertHalfWidthKanaToFullWidth(text, sourceMap=null) {
@@ -513,7 +513,7 @@ export class JapaneseUtil {
/**
* @param {string} text
- * @param {?TextSourceMap} sourceMap
+ * @param {?import('../../general/text-source-map.js').TextSourceMap} sourceMap
* @returns {string}
*/
convertAlphabeticToKana(text, sourceMap=null) {
@@ -676,7 +676,7 @@ export class JapaneseUtil {
/**
* @param {string} text
* @param {boolean} fullCollapse
- * @param {?TextSourceMap} [sourceMap]
+ * @param {?import('../../general/text-source-map.js').TextSourceMap} [sourceMap]
* @returns {string}
*/
collapseEmphaticSequences(text, fullCollapse, sourceMap=null) {
@@ -816,7 +816,7 @@ export class JapaneseUtil {
/**
* @param {string} text
- * @param {?TextSourceMap} sourceMap
+ * @param {?import('../../general/text-source-map.js').TextSourceMap} sourceMap
* @param {number} sourceMapStart
* @returns {string}
*/
diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js
index b4d9a642..f6bcde8d 100644
--- a/ext/js/language/text-scanner.js
+++ b/ext/js/language/text-scanner.js
@@ -18,6 +18,7 @@
import {EventDispatcher, EventListenerCollection, clone, log} from '../core.js';
import {DocumentUtil} from '../dom/document-util.js';
+import {TextSourceElement} from '../dom/text-source-element.js';
import {yomitan} from '../yomitan.js';
/**
diff --git a/ext/js/language/translator.js b/ext/js/language/translator.js
index 67cc53c6..c21b16b1 100644
--- a/ext/js/language/translator.js
+++ b/ext/js/language/translator.js
@@ -29,9 +29,9 @@ export class Translator {
* @param {import('translator').ConstructorDetails} details The details for the class.
*/
constructor({japaneseUtil, database}) {
- /** @type {JapaneseUtil} */
+ /** @type {import('./sandbox/japanese-util.js').JapaneseUtil} */
this._japaneseUtil = japaneseUtil;
- /** @type {DictionaryDatabase} */
+ /** @type {import('./dictionary-database.js').DictionaryDatabase} */
this._database = database;
/** @type {?Deinflector} */
this._deinflector = null;