mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
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:
parent
9ec9fb5742
commit
8f7dffc7a5
18
types/localized-countries/index.d.ts
vendored
Normal file
18
types/localized-countries/index.d.ts
vendored
Normal 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;
|
||||
10
types/localized-countries/localized-countries-tests.ts
Normal file
10
types/localized-countries/localized-countries-tests.ts
Normal 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"
|
||||
22
types/localized-countries/tsconfig.json
Normal file
22
types/localized-countries/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",
|
||||
"localized-countries-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/localized-countries/tslint.json
Normal file
1
types/localized-countries/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user