From a94d5ef55254f79746740f7819dedf44936efbf2 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Sat, 9 Apr 2022 16:08:57 +0500 Subject: [PATCH] update verbEntry predicate stuff --- package.json | 2 +- src/lib/type-predicates.ts | 6 +++++- src/types.ts | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index a3c2ffb..8c0de20 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lingdocs/pashto-inflector", - "version": "1.8.0", + "version": "1.8.1", "author": "lingdocs.com", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "homepage": "https://verbs.lingdocs.com", diff --git a/src/lib/type-predicates.ts b/src/lib/type-predicates.ts index e01c60a..ad614d8 100644 --- a/src/lib/type-predicates.ts +++ b/src/lib/type-predicates.ts @@ -27,8 +27,12 @@ export function isNounOrAdjEntry(e: T.Entry): e is (T.NounEntry | T.AdjectiveEnt return isNounEntry(e) || isAdjectiveEntry(e); } +export function isVerbDictionaryEntry(e: T.DictionaryEntry): e is T.VerbDictionaryEntry { + return e && !!e.c?.startsWith("v.") +} + export function isVerbEntry(e: T.Entry | T.DictionaryEntry): e is T.VerbEntry { - return "entry" in e && !!e.entry.c?.startsWith("v."); + return "entry" in e && isVerbDictionaryEntry(e.entry); } export function isMascNounEntry(e: T.NounEntry | T.AdjectiveEntry): e is T.MascNounEntry { diff --git a/src/types.ts b/src/types.ts index 8db91ad..9e580de 100644 --- a/src/types.ts +++ b/src/types.ts @@ -481,8 +481,9 @@ export type UnisexNounEntry = MascNounEntry & { __brand3: "a unisex noun entry" export type AdverbEntry = DictionaryEntry & { c: string } & { __brand: "an adverb entry" }; export type LocativeAdverbEntry = AdverbEntry & { __brand2: "a locative adverb entry" }; export type AdjectiveEntry = DictionaryEntry & { c: string } & { __brand: "an adjective entry" }; +export type VerbDictionaryEntry = DictionaryEntry & { __brand: "a verb entry" }; export type VerbEntry = { - entry: DictionaryEntry & { __brand: "a verb entry" }, + entry: VerbDictionaryEntry, // TODO: the compliment could also be typed? Maybe? complement?: DictionaryEntry, };