TS docs updates (#2041)

* Fix placeholder descriptions

* Use an enum

* Add enums
This commit is contained in:
toasted-nutbread 2021-12-17 20:00:57 -05:00 committed by GitHub
parent 8a377cabe6
commit 851014a404
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,16 +18,24 @@
namespace Translation {
// Common
/**
* Enum representing the type of a `DictionaryEntry`.
* `'kanji'` corresponds to a KanjiDictionaryEntry.
* `'term'` corresponds to a TermDictionaryEntry.
*/
export enum DictionaryEntryType {
Kanji = 'kanji',
Term = 'term',
}
/**
* A generic dictionary entry which is used as the base interface.
*/
export interface DictionaryEntry {
/**
* A string corresponding to the type of the entry.
* `'kanji'` corresponds to a KanjiDictionaryEntry.
* `'term'` corresponds to a TermDictionaryEntry.
* The type of the entry.
*/
type: string;
type: DictionaryEntryType;
}
/**
@ -71,7 +79,7 @@ namespace Translation {
/**
* A dictionary entry for a kanji character.
* `DictionaryEntry.type` is always `'kanji'`.
* `DictionaryEntry.type` is always `DictionaryEntryType.Kanji`.
*/
export interface KanjiDictionaryEntry extends DictionaryEntry {
/**
@ -196,7 +204,7 @@ namespace Translation {
/**
* A dictionary entry for a term or group of terms.
* `DictionaryEntry.type` is always `'term'`.
* `DictionaryEntry.type` is always `DictionaryEntryType.Term`.
*/
export interface TermDictionaryEntry extends DictionaryEntry {
/**
@ -363,11 +371,11 @@ namespace Translation {
*/
position: number;
/**
* Positions of moras that have a .
* Positions of morae with a nasal sound.
*/
nasalPositions: number[];
/**
* Position of the downstep, as a number of mora.
* Positions of morae with a devoiced sound.
*/
devoicePositions: [];
/**
@ -419,6 +427,24 @@ namespace Translation {
displayValueParsed: boolean;
}
/**
* Enum representing how the search term relates to the final term.
*/
export enum TermSourceMatchType {
Exact = 'exact',
Prefix = 'prefix',
Suffix = 'suffix',
}
/**
* Enum representing what database field was used to match the source term.
*/
export enum TermSourceMatchSource {
Term = 'term',
Reading = 'reading',
Sequence = 'sequence',
}
/**
* Source information represents how the original text was transformed to get to the final term.
*/
@ -437,14 +463,12 @@ namespace Translation {
deinflectedText: string;
/**
* How the deinflected text matches the value from the database.
* Value can be one of: 'exact', 'prefix', 'suffix'
*/
matchType: string;
matchType: TermSourceMatchType;
/**
* Which field was used to match the database entry.
* Value can be one of: 'term', 'reading', 'sequence'
*/
matchSource: string;
matchSource: TermSourceMatchSource;
/**
* Whether or not this source is a primary source. Primary sources are derived from the
* original search text, while non-primary sources originate from related terms.