mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
Merge pull request #32135 from biltongza/country-data
[country-data] Add types
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import * as lib from 'country-data';
|
||||
|
||||
lib.callingCodes.all; // $ExpectType ReadonlyArray<string>
|
||||
lib.callingCountries.all; // $ExpectType ReadonlyArray<Country>
|
||||
lib.continents.africa; // $ExpectType Continent
|
||||
lib.continents.africa.countries; // $ExpectType ReadonlyArray<Country>
|
||||
lib.countries.all; // $ExpectType ReadonlyArray<Country>
|
||||
lib.currencies.all; // $ExpectType ReadonlyArray<Currency>
|
||||
lib.languages.all; // $ExpectType ReadonlyArray<Language>
|
||||
lib.regions.antarctica; // $ExpectType Region
|
||||
lib.regions.antarctica.countries; // $ExpectType ReadonlyArray<string>
|
||||
lib.lookup.countries(""); // $ExpectType ReadonlyArray<Country>
|
||||
lib.lookup.currencies(""); // $ExpectType ReadonlyArray<Currency>
|
||||
lib.lookup.languages(""); // $ExpectType ReadonlyArray<Language>
|
||||
Vendored
+103
@@ -0,0 +1,103 @@
|
||||
// Type definitions for country-data 0.0
|
||||
// Project: https://github.com/OpenBookPrices/country-data
|
||||
// Definitions by: Logan Dam <https://github.com/biltongza>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface Country {
|
||||
readonly alpha2: string;
|
||||
readonly alpha3: string;
|
||||
readonly countryCallingCodes: ReadonlyArray<string>;
|
||||
readonly currencies: ReadonlyArray<string>;
|
||||
readonly emoji: string;
|
||||
readonly ioc: string;
|
||||
readonly languages: ReadonlyArray<string>;
|
||||
readonly name: string;
|
||||
readonly status: string;
|
||||
}
|
||||
|
||||
export interface Currency {
|
||||
readonly code: string;
|
||||
readonly decimals: number;
|
||||
readonly name: string;
|
||||
readonly number: number;
|
||||
}
|
||||
|
||||
export interface Language {
|
||||
readonly alpha2: string;
|
||||
readonly alpha3: string;
|
||||
readonly bibliographic: string;
|
||||
readonly name: string;
|
||||
}
|
||||
|
||||
export interface Continent {
|
||||
readonly name: string;
|
||||
readonly regions: ReadonlyArray<string>;
|
||||
readonly countries: ReadonlyArray<Country>;
|
||||
}
|
||||
|
||||
export interface Region {
|
||||
readonly name: string;
|
||||
readonly countries: ReadonlyArray<string>;
|
||||
}
|
||||
|
||||
export const countries: {
|
||||
readonly all: ReadonlyArray<Country>;
|
||||
};
|
||||
|
||||
export const continents: {
|
||||
readonly africa: Continent;
|
||||
readonly antarctica: Continent;
|
||||
readonly asia: Continent;
|
||||
readonly europe: Continent;
|
||||
readonly northAmerica: Continent;
|
||||
readonly oceania: Continent;
|
||||
readonly southAmerica: Continent;
|
||||
};
|
||||
|
||||
export const callingCodes: {
|
||||
readonly all: ReadonlyArray<string>;
|
||||
};
|
||||
|
||||
export const callingCountries: {
|
||||
readonly all: ReadonlyArray<Country>;
|
||||
};
|
||||
|
||||
export const currencies: {
|
||||
readonly all: ReadonlyArray<Currency>;
|
||||
};
|
||||
|
||||
export const languages: {
|
||||
readonly all: ReadonlyArray<Language>;
|
||||
};
|
||||
|
||||
export const regions: {
|
||||
readonly centralAsia: Region;
|
||||
readonly southernAsia: Region;
|
||||
readonly southeastAsia: Region;
|
||||
readonly eastAsia: Region;
|
||||
readonly westernAsia: Region;
|
||||
readonly centralAfrica: Region;
|
||||
readonly northAfrica: Region;
|
||||
readonly southernAfrica: Region;
|
||||
readonly eastAfrica: Region;
|
||||
readonly westAfrica: Region;
|
||||
readonly centralAmerica: Region;
|
||||
readonly northernAmerica: Region;
|
||||
readonly caribbean: Region;
|
||||
readonly southAmerica: Region;
|
||||
readonly antarctica: Region;
|
||||
readonly northernEurope: Region;
|
||||
readonly southernEurope: Region;
|
||||
readonly easternEurope: Region;
|
||||
readonly westernEurope: Region;
|
||||
readonly australia: Region;
|
||||
readonly melanesia: Region;
|
||||
readonly micronesia: Region;
|
||||
readonly polynesia: Region;
|
||||
};
|
||||
|
||||
export const lookup: {
|
||||
readonly countries: (query: any) => ReadonlyArray<Country>;
|
||||
readonly currencies: (query: any) => ReadonlyArray<Currency>;
|
||||
readonly languages: (query: any) => ReadonlyArray<Language>;
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"country-data-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user