[countries-and-timezones] Add typings for v2.0 (#39052)

* [countries-and-timezones] Add typings for v2.0

* Fix path mapping

* Fix copy pasta mistake

* Remove v1 typings
This commit is contained in:
Piotr Okoński
2019-10-18 08:50:59 -07:00
committed by Andrew Branch
parent 221b638fa2
commit 18653eae1a
2 changed files with 17 additions and 12 deletions
@@ -1,6 +1,8 @@
import * as lib from 'countries-and-timezones';
lib.getCountry('IT');
lib.getTimezone('Europe/Warsaw');
lib.getAllCountries();
lib.getAllTimezones();
lib.getCountriesForTimezone('Europe/London');
lib.getCountryForTimezone('Europe/London');
lib.getTimezonesForCountry('GB');
+14 -11
View File
@@ -1,25 +1,28 @@
// Type definitions for countries-and-timezones 1.0
// Type definitions for countries-and-timezones 2.0
// Project: https://github.com/manuelmhtr/countries-and-timezones#readme
// Definitions by: David Bird <https://github.com/zero51>
// Piotr Okoński <https://github.com/pokonski>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Country {
id: string;
name: string;
timezones: string[];
timezones: ReadonlyArray<string>;
}
export interface Timezone {
name: string;
utcOffset: number;
offsetStr: string;
countries: string[];
utcOffsetStr: string;
dstOffset: number;
dstOffsetStr: string;
aliasOf: string | null;
country: string | null;
}
export function getAllCountries(): {[key: string]: Country};
export function getAllTimezones(): {[key: string]: Timezone};
export function getCountriesForTimezone(timezoneId: string): Country[];
export function getTimezonesForCountry(countryId: string): Timezone[];
export function getCountry(id: string): Country;
export function getTimezone(name: string): Timezone;
export function getAllCountries(): Country[];
export function getAllTimezones(): Timezone[];
export function getCountryForTimezone(name: string): Country;
export function getTimezonesForCountry(id: string): Timezone[];