diff options
Diffstat (limited to 'src/models')
| -rw-r--r-- | src/models/FetchedCountry.model.ts | 9 | ||||
| -rw-r--r-- | src/models/country.model.ts | 23 |
2 files changed, 26 insertions, 6 deletions
diff --git a/src/models/FetchedCountry.model.ts b/src/models/FetchedCountry.model.ts new file mode 100644 index 0000000..be636ff --- /dev/null +++ b/src/models/FetchedCountry.model.ts @@ -0,0 +1,9 @@ +export interface FetchedCountry { + country: string; + flag: string; + languages: string; + capital: string; + region: string; + population: number; + currencies: string; +} diff --git a/src/models/country.model.ts b/src/models/country.model.ts index 4765d5e..1a6b3ae 100644 --- a/src/models/country.model.ts +++ b/src/models/country.model.ts @@ -1,9 +1,20 @@ // For better currency types, this can be used later: // https://github.com/freeall/currency-codes // Same can be done for language abbreviations -export type CurrencyAbbr = string; -export type CurrencyInfo = { name: string; symbol: string }; -export type LangAbbr = string; +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: { @@ -11,10 +22,10 @@ export interface Country { official: string; // Need type for nativeName later }; - currencies: Record<CurrencyAbbr, CurrencyInfo>; + currencies: Currencies; capital: string[]; flag: string; population: number; - languages: Record<LangAbbr, string>; - region: string; + languages: Languages; + region: Region; } |
