diff --git a/types/localized-countries/index.d.ts b/types/localized-countries/index.d.ts new file mode 100644 index 0000000000..e882f46eb0 --- /dev/null +++ b/types/localized-countries/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for localized-countries 1.0 +// Project: https://github.com/marcbachmann/localized-countries#readme +// Definitions by: 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; diff --git a/types/localized-countries/localized-countries-tests.ts b/types/localized-countries/localized-countries-tests.ts new file mode 100644 index 0000000000..cb4b097dcf --- /dev/null +++ b/types/localized-countries/localized-countries-tests.ts @@ -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" diff --git a/types/localized-countries/tsconfig.json b/types/localized-countries/tsconfig.json new file mode 100644 index 0000000000..ebd99f99c2 --- /dev/null +++ b/types/localized-countries/tsconfig.json @@ -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" + ] +} diff --git a/types/localized-countries/tslint.json b/types/localized-countries/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/localized-countries/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }