typings for localized-countries (#18809)

Complete and tested. The module has two flavors, one for browser and one
For node. The typings cover both of them.
This commit is contained in:
coderslagoon 2017-08-14 11:09:49 -07:00 committed by Mohamed Hegazy
parent 9ec9fb5742
commit 8f7dffc7a5
4 changed files with 51 additions and 0 deletions

18
types/localized-countries/index.d.ts vendored Normal file
View File

@ -0,0 +1,18 @@
// Type definitions for localized-countries 1.0
// Project: https://github.com/marcbachmann/localized-countries#readme
// Definitions by: coderslagoon <https://github.com/coderslagoon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
interface LocalizedCountries {
get(code: string): string;
array(): Array<{
code: string;
label: string;
}>;
object(): { [code: string]: string };
}
declare function localizedCountries(locale: string|object): LocalizedCountries;
export = localizedCountries;

View File

@ -0,0 +1,10 @@
import localizedCountries = require("localized-countries");
localizedCountries("de").get("DE");
// => "Deutschland"
localizedCountries("en").get("US");
// => "United States"
localizedCountries("de").object()["DE"];
// => "Deutschland"

View 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",
"localized-countries-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }