mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #22515 from gatimus/add-provinces
add provinces package
This commit is contained in:
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
// Type definitions for provinces 1.11
|
||||
// Project: https://github.com/substack/provinces
|
||||
// Definitions by: My Self <https://github.com/gatimus>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare global {
|
||||
/**
|
||||
* @see {@link https://github.com/substack/provinces#data-format}
|
||||
*/
|
||||
interface Province {
|
||||
/**
|
||||
* full name of the province or state
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* country abbreviation
|
||||
*/
|
||||
country: string;
|
||||
/**
|
||||
* optional 2 or 3 character short name
|
||||
*/
|
||||
short?: string;
|
||||
/**
|
||||
* optional array of additional names and abbreviations
|
||||
*/
|
||||
alt?: string[];
|
||||
/**
|
||||
* optional region of a country (for example: "Wales")
|
||||
*/
|
||||
region?: string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see {@link https://github.com/substack/provinces#methods}
|
||||
*/
|
||||
declare const provinces: Province[];
|
||||
|
||||
export = provinces;
|
||||
@@ -0,0 +1,16 @@
|
||||
import * as provinces from 'provinces';
|
||||
|
||||
provinces.forEach((province: Province) => {
|
||||
// https://github.com/substack/provinces#data-format
|
||||
let name: string;
|
||||
let country: string;
|
||||
let short: string;
|
||||
let alt: string[];
|
||||
let region: string;
|
||||
|
||||
name = province.name;
|
||||
country = province.country;
|
||||
short = province.short ? province.short : '';
|
||||
alt = province.alt ? province.alt : [];
|
||||
region = province.region ? province.region : '';
|
||||
});
|
||||
@@ -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",
|
||||
"provinces-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Reference in New Issue
Block a user