update verbEntry predicate stuff

This commit is contained in:
lingdocs 2022-04-09 16:08:57 +05:00
parent 8d841a6c24
commit a94d5ef552
3 changed files with 8 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "1.8.0", "version": "1.8.1",
"author": "lingdocs.com", "author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com", "homepage": "https://verbs.lingdocs.com",

View File

@ -27,8 +27,12 @@ export function isNounOrAdjEntry(e: T.Entry): e is (T.NounEntry | T.AdjectiveEnt
return isNounEntry(e) || isAdjectiveEntry(e); 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 { 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 { export function isMascNounEntry(e: T.NounEntry | T.AdjectiveEntry): e is T.MascNounEntry {

View File

@ -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 AdverbEntry = DictionaryEntry & { c: string } & { __brand: "an adverb entry" };
export type LocativeAdverbEntry = AdverbEntry & { __brand2: "a locative adverb entry" }; export type LocativeAdverbEntry = AdverbEntry & { __brand2: "a locative adverb entry" };
export type AdjectiveEntry = DictionaryEntry & { c: string } & { __brand: "an adjective entry" }; export type AdjectiveEntry = DictionaryEntry & { c: string } & { __brand: "an adjective entry" };
export type VerbDictionaryEntry = DictionaryEntry & { __brand: "a verb entry" };
export type VerbEntry = { export type VerbEntry = {
entry: DictionaryEntry & { __brand: "a verb entry" }, entry: VerbDictionaryEntry,
// TODO: the compliment could also be typed? Maybe? // TODO: the compliment could also be typed? Maybe?
complement?: DictionaryEntry, complement?: DictionaryEntry,
}; };