Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions types/russian-nouns-js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const CASES: [Case];
/**
* Интерфейс с именованными параметрами для создания лемм.
* Если параметр — уже лемма, вернет тот же объект, а не копию.
* То же, что и статический метод {@link Lemma.create}.
*
* @param {RussianNouns.Lemma|Object} o
* @throws {Error} Ошибки из конструктора леммы.
Expand All @@ -27,6 +28,7 @@ export function createLemma(o: Lemma | LemmaOptions): Lemma;

/**
* Безопасное создание леммы с минимальными накладными расходами.
* То же, что и статический метод {@link Lemma.createOrNull}.
*
* @param {Object} options
* @returns {RussianNouns.Lemma|null}
Expand Down
2 changes: 1 addition & 1 deletion types/russian-nouns-js/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/russian-nouns-js",
"version": "2.3.9999",
"version": "2.4.9999",
"projects": [
"https://github.com/georgy7/RussianNounsJS"
],
Expand Down
24 changes: 7 additions & 17 deletions types/russian-nouns-js/russian-nouns-js-tests.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
import {
Case,
CASES,
createLemma,
createLemmaOrNull,
Engine,
Gender,
Lemma,
LocativeForm,
LocativeFormAttribute,
} from "russian-nouns-js";
import { Case, CASES, Engine, Gender, Lemma, LocativeForm, LocativeFormAttribute } from "russian-nouns-js";

const rne = new Engine();

Expand All @@ -21,7 +11,7 @@ result = rne.decline({ text: "имя", gender: Gender.NEUTER }, Case.GENITIVE);

result = rne.decline({ text: "имя", gender: Gender.NEUTER }, Case.INSTRUMENTAL);

let coat: Lemma = createLemma({
let coat: Lemma = Lemma.create({
text: "пальто",
gender: Gender.NEUTER,
indeclinable: true,
Expand All @@ -31,7 +21,7 @@ result = rne.decline(coat, Case.GENITIVE);

num = coat.getDeclension();

let mountain: Lemma = createLemma({
let mountain: Lemma = Lemma.create({
text: "гора",
gender: Gender.FEMININE,
});
Expand All @@ -53,9 +43,9 @@ num = mountain.getSchoolDeclension();

let mountainGender: Gender | undefined = mountain.getGender();

let nothing: Lemma | null = createLemmaOrNull({ text: "абвгд" });
let nothing: Lemma | null = Lemma.createOrNull({ text: "абвгд" });

const x: Lemma | null = createLemmaOrNull({
const x: Lemma | null = Lemma.createOrNull({
text: "гора",
gender: Gender.FEMININE,
});
Expand All @@ -66,7 +56,7 @@ if (x != null) {

// ----------------------------------------------------------------------------

const cringe: Lemma = createLemma({
const cringe: Lemma = Lemma.create({
text: "кринж",
gender: Gender.MASCULINE,
});
Expand All @@ -80,7 +70,7 @@ const stressedEndings: boolean[] = rne.sd.hasStressedEndingSingular(cringe, Case

// ----------------------------------------------------------------------------

let row: Lemma = createLemma({
let row: Lemma = Lemma.create({
text: "ряд",
gender: Gender.MASCULINE,
});
Expand Down
8 changes: 3 additions & 5 deletions types/russian-nouns-js/src/Lemma.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ export interface LemmaOptions {
}

export class Lemma {
/**
* Not for external use.
* Please use createLemma or createLemmaOrNull instead of the constructor.
*/
constructor(o: LemmaOptions | Lemma);
private constructor(o: LemmaOptions | Lemma);
static create(o: Lemma | LemmaOptions): Lemma;
static createOrNull(options: LemmaOptions): Lemma | null;

/**
* @deprecated since version 2.0.0
Expand Down