From d63490f91b7b5edd6c69fb3f42db4ef12a0f0886 Mon Sep 17 00:00:00 2001 From: Adaline Simonian Date: Mon, 13 Jan 2025 11:08:42 -0800 Subject: [PATCH] fix: make ExampleCategory.morphemes optional also fixes formatting lint error --- locale/config.ts | 5 +++-- src/data.ts | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/locale/config.ts b/locale/config.ts index 43667e725..33f162a5d 100644 --- a/locale/config.ts +++ b/locale/config.ts @@ -145,9 +145,10 @@ interface ExampleCategory { */ name: string; /** - * which morphemes belong to this category. visible example sentences will contain at least one listed morpheme + * which morphemes belong to this category. visible example sentences will contain at least one listed morpheme. + * if not present, example categories must be assigned to examples using the comma-separated "categories" column in examples.tsv */ - morphemes: string[]; + morphemes?: string[]; /** * whether this category is only shown in comprehensive view * @default false diff --git a/src/data.ts b/src/data.ts index 8834540c9..b7968a8aa 100644 --- a/src/data.ts +++ b/src/data.ts @@ -20,7 +20,10 @@ export const examples = buildList(function* () { Example.parse(e.null || e.singular), Example.parse(e.null_plural || e.plural || e.singular), e.isHonorific, - e.categories ? e.categories.split(',').map(c => c.trim()).filter(c => c) : [], + e.categories + ? e.categories.split(',').map((c) => c.trim()) + .filter((c) => c) + : [], ); } });