From acb9cf5a81ec42e64a59f4708345f1af63147a34 Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Sun, 23 Apr 2023 12:28:48 +0200 Subject: refactor(locale): use null as not applicable (#2078) --- src/definitions/definitions.ts | 6 +++--- src/definitions/person.ts | 40 ++++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src/definitions') diff --git a/src/definitions/definitions.ts b/src/definitions/definitions.ts index dd477beb..413b2bd7 100644 --- a/src/definitions/definitions.ts +++ b/src/definitions/definitions.ts @@ -22,9 +22,9 @@ import type { WordDefinitions } from './word'; /** * Wrapper type for all definition categories that will make all properties optional and allow extra properties. */ -export type LocaleEntry> = Partial & - // Unsupported & custom entries - Record; +export type LocaleEntry> = { + [P in keyof T]?: T[P] | null; +} & Record; // Unsupported & custom entries /** * The definitions as used by the translations/locales. diff --git a/src/definitions/person.ts b/src/definitions/person.ts index 9cc86d3a..b300a689 100644 --- a/src/definitions/person.ts +++ b/src/definitions/person.ts @@ -7,21 +7,21 @@ export type PersonDefinitions = LocaleEntry<{ gender: string[]; sex: string[]; - prefix?: string[]; - female_prefix?: string[]; - male_prefix?: string[]; + prefix: string[]; + female_prefix: string[]; + male_prefix: string[]; - first_name?: string[]; - female_first_name?: string[]; - male_first_name?: string[]; + first_name: string[]; + female_first_name: string[]; + male_first_name: string[]; - middle_name?: string[]; - female_middle_name?: string[]; - male_middle_name?: string[]; + middle_name: string[]; + female_middle_name: string[]; + male_middle_name: string[]; - last_name?: string[]; - female_last_name?: string[]; - male_last_name?: string[]; + last_name: string[]; + female_last_name: string[]; + male_last_name: string[]; suffix: string[]; @@ -33,11 +33,11 @@ export type PersonDefinitions = LocaleEntry<{ /** * A weighted list of patterns used to generate last names. */ - last_name_pattern?: Array<{ value: string; weight: number }>; - male_last_name_pattern?: Array<{ value: string; weight: number }>; - female_last_name_pattern?: Array<{ value: string; weight: number }>; + last_name_pattern: Array<{ value: string; weight: number }>; + male_last_name_pattern: Array<{ value: string; weight: number }>; + female_last_name_pattern: Array<{ value: string; weight: number }>; - bio_pattern?: string[]; + bio_pattern: string[]; title: PersonTitleDefinitions; @@ -47,8 +47,8 @@ export type PersonDefinitions = LocaleEntry<{ /** * The possible definitions related to people's titles. */ -export interface PersonTitleDefinitions { - descriptor?: string[]; +export type PersonTitleDefinitions = LocaleEntry<{ + descriptor: string[]; job: string[]; - level?: string[]; -} + level: string[]; +}>; -- cgit v1.2.3