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", "name": "pashto-inflector",
"version": "5.8.3", "version": "5.8.4",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "pashto-inflector", "name": "pashto-inflector",
"version": "5.8.3", "version": "5.8.4",
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {

View File

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

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

View File

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

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/inflect", "name": "@lingdocs/inflect",
"version": "5.8.3", "version": "5.8.4",
"description": "Pashto inflector library", "description": "Pashto inflector library",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/lib/library.d.ts", "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 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 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 const dictionaryEntryTextFields = [
export type DictionaryEntryNumberField = "ts" | "r" | "i" | "l" | "separationAtP" | "separationAtF"; "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; export type DictionaryEntryField = DictionaryEntryTextField | DictionaryEntryBooleanField | DictionaryEntryNumberField;
// TODO: make // TODO: make