Add declarations for 'countries-and-timezones' (#20055)

This commit is contained in:
David Bird
2017-09-28 02:54:36 +10:00
committed by Mohamed Hegazy
parent 36318f37a4
commit 782ba8d828
4 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
import * as lib from 'countries-and-timezones';
lib.getAllCountries();
lib.getAllTimezones();
lib.getCountriesForTimezone('Europe/London');
lib.getTimezonesForCountry('GB');

View File

@@ -0,0 +1,25 @@
// Type definitions for countries-and-timezones 1.0
// Project: https://github.com/manuelmhtr/countries-and-timezones#readme
// Definitions by: David Bird <https://github.com/zero51>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Country {
id: string;
name: string;
timezones: string[];
}
export interface Timezone {
name: string;
utcOffset: number;
offsetStr: string;
countries: string[];
}
export function getAllCountries(): Country[];
export function getAllTimezones(): Timezone[];
export function getCountriesForTimezone(timezoneId: string): Country[];
export function getTimezonesForCountry(countryId: string): Timezone[];

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"countries-and-timezones-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }