Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
1 parent
221b638
commit 18653ea
Showing
2 changed files
with
17 additions
and
12 deletions.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
types/countries-and-timezones/countries-and-timezones-tests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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[]; |