less redundancy using as const

This commit is contained in:
adueck 2023-03-16 13:05:37 +05:00
parent 13fdbf8201
commit 1ebe2256da
7 changed files with 43 additions and 45 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "pashto-inflector",
"version": "5.8.3",
"version": "5.8.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "pashto-inflector",
"version": "5.8.3",
"version": "5.8.4",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "pashto-inflector",
"version": "5.8.3",
"version": "5.8.4",
"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",

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/ps-react",
"version": "5.8.3",
"version": "5.8.4",
"description": "Pashto inflector library module with React components",
"main": "dist/components/library.js",
"module": "dist/components/library.js",

View File

@ -72,7 +72,7 @@ import {
dictionaryEntryBooleanFields,
dictionaryEntryNumberFields,
dictionaryEntryTextFields,
} from "./src/fields";
} from "../types";
import {
validateEntry,
standardizeEntry,
@ -162,7 +162,7 @@ import {
import shuffleArray from "./src/shuffle-array";
import defaultTextOptions from "./src/default-text-options";
import * as grammarUnits from "./src/grammar-units";
import * as Types from "../types";
import type * as Types from "../types";
import * as typePredicates from "./src/type-predicates";
import * as blockUtils from "./src/phrase-building/blocks-utils";

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/inflect",
"version": "5.8.3",
"version": "5.8.4",
"description": "Pashto inflector library",
"main": "dist/index.js",
"types": "dist/lib/library.d.ts",

View File

@ -1,35 +0,0 @@
import * as T from "../../types";
export const dictionaryEntryTextFields: T.DictionaryEntryTextField[] = [
"p",
"f",
"e",
"c",
"infap",
"infaf",
"infbp",
"infbf",
"app",
"apf",
"ppp",
"ppf",
"psp",
"psf",
"ssp",
"ssf",
"prp",
"prf",
"pprtp",
"pprtf",
"tppp",
"tppf",
"ec",
"ep",
];
export const dictionaryEntryBooleanFields: T.DictionaryEntryBooleanField[] = [
"noInf", "shortIntrans", "noOo", "sepOo", "diacExcept",
];
export const dictionaryEntryNumberFields: T.DictionaryEntryNumberField[] = [
"ts", "r", "i", "l", "separationAtP", "separationAtF",
];

View File

@ -145,9 +145,42 @@ export type DictionaryEntryNoFVars = DictionaryEntry & { __brand: "name for a di
export type PsStringNoFVars = PsString & { __brand: "name for a ps string with all the phonetics variations removed" };
export type FStringNoFVars = string & { __brand: "name for a phonetics string with all the phonetics variations removed" };
export type DictionaryEntryTextField = "p" | "f" | "e" | "c" | "infap" | "infaf" | "infbp" | "infbf" | "app" | "apf" | "ppp" | "ppf" | "psp" | "psf" | "ssp" | "ssf" | "prp" | "prf" | "pprtp" | "pprtf" | "tppp" | "tppf" | "ec" | "ep";
export type DictionaryEntryBooleanField = "noInf" | "shortIntrans" | "noOo" | "sepOo" | "diacExcept";
export type DictionaryEntryNumberField = "ts" | "r" | "i" | "l" | "separationAtP" | "separationAtF";
export const dictionaryEntryTextFields = [
"p",
"f",
"e",
"c",
"infap",
"infaf",
"infbp",
"infbf",
"app",
"apf",
"ppp",
"ppf",
"psp",
"psf",
"ssp",
"ssf",
"prp",
"prf",
"pprtp",
"pprtf",
"tppp",
"tppf",
"ec",
"ep",
] as const;
export type DictionaryEntryTextField = typeof dictionaryEntryTextFields[number];
export const dictionaryEntryBooleanFields = [
"noInf", "shortIntrans", "noOo", "sepOo", "diacExcept",
] as const;
export const dictionaryEntryNumberFields = [
"ts", "r", "i", "l", "separationAtP", "separationAtF",
] as const;
export type DictionaryEntryBooleanField = typeof dictionaryEntryBooleanFields[number];
export type DictionaryEntryNumberField = typeof dictionaryEntryNumberFields[number];
export type DictionaryEntryField = DictionaryEntryTextField | DictionaryEntryBooleanField | DictionaryEntryNumberField;
// TODO: make