aboutsummaryrefslogtreecommitdiff
path: root/types/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-12-20 00:47:15 -0500
committerGitHub <noreply@github.com>2023-12-20 05:47:15 +0000
commit8b943cc97fab890085448122e7c13dd035d0e238 (patch)
treea7a749a44771c6a82b1b72bb35cc0c81d57ddb54 /types/ext
parentb13fbd47941fc20cf623871396e34a6dfe9b4dba (diff)
JSON validation (#394)
* Set up JSON testing * Add schema validation * Use parseJson * Finish types * Disambiguate ext/json-schema from node dependency with the same name * Add support for specifying the jsconfig file * Don't expose types * Update types * Use dictionary map type * Fix types * Fix AJV warnings * Move types * Move anb rename file * Move common mocks * Simplify types
Diffstat (limited to 'types/ext')
-rw-r--r--types/ext/dictionary-data.d.ts20
-rw-r--r--types/ext/structured-content.d.ts8
-rw-r--r--types/ext/translation.d.ts2
3 files changed, 20 insertions, 10 deletions
diff --git a/types/ext/dictionary-data.d.ts b/types/ext/dictionary-data.d.ts
index f594f913..b194c190 100644
--- a/types/ext/dictionary-data.d.ts
+++ b/types/ext/dictionary-data.d.ts
@@ -44,6 +44,8 @@ export type IndexTag = {
score: number;
};
+export type TermV1Array = TermV1[];
+
export type TermV1 = [
expression: string,
reading: string,
@@ -53,6 +55,8 @@ export type TermV1 = [
...glossary: string[],
];
+export type TermV3Array = TermV3[];
+
export type TermV3 = [
expression: string,
reading: string,
@@ -64,6 +68,8 @@ export type TermV3 = [
termTags: string,
];
+export type KanjiV1Array = KanjiV1[];
+
export type KanjiV1 = [
character: string,
onyomi: string,
@@ -72,6 +78,8 @@ export type KanjiV1 = [
...meanings: string[],
];
+export type KanjiV3Array = KanjiV3[];
+
export type KanjiV3 = [
character: string,
onyomi: string,
@@ -93,7 +101,13 @@ export type TermGlossaryText = {type: 'text', text: string};
export type TermGlossaryImage = {type: 'image'} & TermImage;
export type TermGlossaryStructuredContent = {type: 'structured-content', content: StructuredContent.Content};
-export type TermImage = StructuredContent.ImageElementBase;
+export type TermImage = StructuredContent.ImageElementBase & {
+ // Compatibility properties
+ verticalAlign?: undefined;
+ sizeUnits?: undefined;
+};
+
+export type TagArray = Tag[];
export type Tag = [
name: string,
@@ -109,6 +123,8 @@ export type GenericFrequencyData = string | number | {
reading?: undefined; // Used for type disambiguation, field does not actually exist
};
+export type TermMetaArray = TermMeta[];
+
export type TermMeta = TermMetaFrequency | TermMetaPitch;
export type TermMetaFrequencyDataWithReading = {
@@ -138,6 +154,8 @@ export type TermMetaPitch = [
data: TermMetaPitchData,
];
+export type KanjiMetaArray = KanjiMeta[];
+
export type KanjiMeta = KanjiMetaFrequency;
export type KanjiMetaFrequency = [
diff --git a/types/ext/structured-content.d.ts b/types/ext/structured-content.d.ts
index 09755c88..572b827a 100644
--- a/types/ext/structured-content.d.ts
+++ b/types/ext/structured-content.d.ts
@@ -161,14 +161,6 @@ export type ImageElementBase = {
* Whether or not the image can be collapsed.
*/
collapsible?: boolean;
- /**
- * This property is not defined on the base class.
- */
- verticalAlign?: undefined;
- /**
- * This property is not defined on the base class.
- */
- sizeUnits?: undefined;
};
export type ImageElement = ImageElementBase & {
diff --git a/types/ext/translation.d.ts b/types/ext/translation.d.ts
index 3adfc673..595a5a35 100644
--- a/types/ext/translation.d.ts
+++ b/types/ext/translation.d.ts
@@ -28,7 +28,7 @@ export type FindKanjiOptions = {
* The mapping of dictionaries to search for kanji in.
* The key is the dictionary name.
*/
- enabledDictionaryMap: Map<string, FindKanjiDictionary>;
+ enabledDictionaryMap: KanjiEnabledDictionaryMap;
/**
* Whether or not non-Japanese characters should be searched.
*/