Socialify

Folder ..

Viewing country.model.ts
38 lines (36 loc) • 927.0 B

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// For better currency types, this can be used later:
// https://github.com/freeall/currency-codes
// Same can be done for language abbreviations
type CurrencyAbbr = string;
type CurrencyInfo = { name: string; symbol: string };
type LangAbbr = string;

export type Currencies = Record<CurrencyAbbr, CurrencyInfo>;
export type Languages = Record<LangAbbr, string>;
export enum Region {
  Asia = "Asia",
  Europe = "Europe",
  Americas = "Americas",
  Africa = "Africa",
  Oceania = "Oceania",
  Antarctic = "Antarctic",
}

export interface Country {
  name: {
    common: string;
    official: string;
    // Need type for nativeName later
  };
  currencies: Currencies;
  capital: string[];
  flag: string;
  population: number;
  languages: Languages;
  region: Region;
  subregion: string; //can later be explicit enum
  timezones: string[];
  latlng: number[];
  capitalInfo: {
    latlng: number[];
  };
  tld: string[];
}