aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/definitions.ts131
-rw-r--r--src/index.ts6
2 files changed, 135 insertions, 2 deletions
diff --git a/src/definitions.ts b/src/definitions.ts
new file mode 100644
index 00000000..db142429
--- /dev/null
+++ b/src/definitions.ts
@@ -0,0 +1,131 @@
+export interface Definitions {
+ address: {
+ city_name;
+ city_prefix;
+ city_suffix;
+ country_code_alpha_3;
+ country_code;
+ country;
+ county;
+ direction_abbr;
+ direction;
+ postcode_by_state;
+ postcode: string | string[];
+ state_abbr;
+ state;
+ street_prefix;
+ street_suffix;
+ time_zone;
+ };
+ animal: {
+ bear;
+ bird;
+ cat;
+ cetacean;
+ cow;
+ crocodilia;
+ dog;
+ fish;
+ horse;
+ insect;
+ lion;
+ rabbit;
+ snake;
+ type;
+ };
+ commerce: {
+ color;
+ department;
+ product_description;
+ product_name;
+ };
+ company: {
+ adjective;
+ bs_adjective;
+ bs_noun;
+ bs_verb;
+ descriptor;
+ noun;
+ suffix;
+ };
+ database: {
+ collation;
+ column;
+ engine;
+ type;
+ };
+ date: {
+ month;
+ weekday;
+ };
+ finance: {
+ account_type;
+ credit_card;
+ currency: Record<string, { code: string; symbol: string }>;
+ transaction_type;
+ };
+ hacker: {
+ abbreviation;
+ adjective;
+ ingverb;
+ noun;
+ phrase;
+ verb;
+ };
+ internet: {
+ domain_suffix;
+ example_email;
+ free_email;
+ };
+ lorem: {
+ words;
+ };
+ music: {
+ genre;
+ };
+ name: {
+ binary_gender;
+ female_first_name;
+ female_last_name;
+ female_middle_name;
+ female_prefix;
+ first_name;
+ gender;
+ last_name;
+ male_first_name;
+ male_last_name;
+ male_middle_name;
+ male_prefix;
+ middle_name;
+ prefix;
+ suffix;
+ title: {
+ descriptor;
+ level;
+ job;
+ };
+ };
+ phone_number: {
+ formats;
+ };
+ system: {
+ directoryPaths;
+ mimeTypes;
+ };
+ vehicle: {
+ bicycle_type;
+ fuel;
+ manufacturer;
+ model;
+ type;
+ };
+ word: {
+ adjective: string[];
+ adverb: string[];
+ conjunction: string[];
+ interjection: string[];
+ noun: string[];
+ preposition: string[];
+ verb: string[];
+ };
+}
diff --git a/src/index.ts b/src/index.ts
index a42aa798..21365202 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -5,6 +5,7 @@ import { Company } from './company';
import { Database } from './database';
import { Datatype } from './datatype';
import { _Date } from './date';
+import type { Definitions } from './definitions';
import { Fake } from './fake';
import { Finance } from './finance';
import { Git } from './git';
@@ -193,6 +194,8 @@ export interface LocaleDefinition {
export type UsableLocale = LiteralUnion<KnownLocale>;
export type UsedLocales = Partial<Record<UsableLocale, LocaleDefinition>>;
+export type { Definitions };
+
export interface FakerOptions {
locales?: UsedLocales;
locale?: UsableLocale;
@@ -225,9 +228,8 @@ export class Faker {
locale: UsableLocale;
localeFallback: UsableLocale;
- // TODO @Shinigami92 2022-01-11: For now we loose types here
// @ts-expect-error: will be lazy filled by constructor
- readonly definitions: Record<keyof DefinitionTypes, any> = {};
+ readonly definitions: Definitions = {};
private readonly definitionTypes: DefinitionTypes = {
name: [
'first_name',