diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-02-02 21:55:53 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-03 02:55:53 +0000 |
commit | c4f248b0f95050fb373c898289b506d042a3731b (patch) | |
tree | f221b6dfd6b806b5fa0f26b9e88c6feb764f60fd /types/test | |
parent | 5a2bc4e542b7f22d1e6a4ba318cfcdc33817d34a (diff) |
Improve translator test inputs typing (#601)
* Add type identifier
* Improve type correctness of translator test utilities
Diffstat (limited to 'types/test')
-rw-r--r-- | types/test/translator.d.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/types/test/translator.d.ts b/types/test/translator.d.ts index b213f9e0..e3199225 100644 --- a/types/test/translator.d.ts +++ b/types/test/translator.d.ts @@ -16,6 +16,7 @@ */ import type {FindTermsMatchType, FindTermsSortOrder, FindTermsVariantMode, FindTermsEmphaticSequencesMode, FindKanjiDictionary, FindTermDictionary} from '../ext/translation'; +import type {SearchResolution} from 'settings'; import type {FindTermsMode} from 'translator'; import type {DictionaryEntry} from 'dictionary'; import type {NoteData} from 'anki-templates'; @@ -30,11 +31,13 @@ export type OptionsList = string | (string | OptionsPreset)[]; export type OptionsPreset = FindKanjiOptionsPreset | FindTermsOptionsPreset; export type FindKanjiOptionsPreset = { + type: 'kanji'; enabledDictionaryMap?: [key: string, value: FindKanjiDictionary][]; removeNonJapaneseCharacters?: boolean; }; export type FindTermsOptionsPreset = { + type: 'terms'; matchType?: FindTermsMatchType; deinflect?: boolean; mainDictionary?: string; @@ -50,8 +53,16 @@ export type FindTermsOptionsPreset = { textReplacements?: (FindTermsTextReplacement[] | null)[]; enabledDictionaryMap?: [key: string, value: FindTermDictionary][]; excludeDictionaryDefinitions?: string[] | null; + searchResolution?: SearchResolution; }; +export type OptionsType = OptionsPreset['type']; + +export type OptionsPresetGeneric<T extends OptionsType> = { + kanji: FindKanjiOptionsPreset; + terms: FindTermsOptionsPreset; +}[T]; + export type FindTermsTextReplacement = { pattern: string; flags: string; |