mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Added back v1 types
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import countries from 'country-list';
|
||||
const Countries = countries();
|
||||
|
||||
Countries.getCode('Barbados'); // BB
|
||||
|
||||
Countries.getCodes();
|
||||
|
||||
Countries.getCodeList();
|
||||
|
||||
Countries.getData();
|
||||
|
||||
Countries.getName('BB'); // Barbados
|
||||
|
||||
Countries.getNameList();
|
||||
|
||||
Countries.getNames();
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
// Type definitions for country-list 1.1
|
||||
// Project: https://github.com/fannarsh/country-list
|
||||
// Definitions by: Kyle Roach <https://github.com/iRoachie>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export default function Countries(): {
|
||||
/**
|
||||
* Expects a two-digit country code. Returns the name for that country. If not found, it returns undefined.
|
||||
*/
|
||||
getName(code: string): string | undefined;
|
||||
|
||||
/**
|
||||
* Expects the English country name. Returns the code for that country. If not found, it returns undefined.
|
||||
*/
|
||||
getCode(name: string): string | undefined;
|
||||
|
||||
/**
|
||||
* Returns an array of all country names.
|
||||
*/
|
||||
getNames(): string[];
|
||||
|
||||
/**
|
||||
* Returns an array of all country codes.
|
||||
*/
|
||||
getCodes(): string[];
|
||||
|
||||
/**
|
||||
* Returns a key-value object of all countries using the name as key.
|
||||
*/
|
||||
getNameList(): {[name: string]: string};
|
||||
|
||||
/**
|
||||
* Returns a key-value object of all countries using the code as key.
|
||||
*/
|
||||
getCodeList(): {[code: string]: string};
|
||||
|
||||
/**
|
||||
* Returns an array of all country information, in the same format as it gets imported.
|
||||
*/
|
||||
getData(): Array<{ code: string, name: string }>;
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"country-list": ["country-list/v1"]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"country-list-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user