mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-11 19:09:04 +08:00
Add declarations for 'countries-and-timezones' (#20055)
This commit is contained in:
committed by
Mohamed Hegazy
parent
36318f37a4
commit
782ba8d828
@@ -0,0 +1,6 @@
|
||||
import * as lib from 'countries-and-timezones';
|
||||
|
||||
lib.getAllCountries();
|
||||
lib.getAllTimezones();
|
||||
lib.getCountriesForTimezone('Europe/London');
|
||||
lib.getTimezonesForCountry('GB');
|
||||
25
types/countries-and-timezones/index.d.ts
vendored
Normal file
25
types/countries-and-timezones/index.d.ts
vendored
Normal 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[];
|
||||
22
types/countries-and-timezones/tsconfig.json
Normal file
22
types/countries-and-timezones/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
1
types/countries-and-timezones/tslint.json
Normal file
1
types/countries-and-timezones/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user