diff --git a/types/langmap/index.d.ts b/types/langmap/index.d.ts new file mode 100644 index 0000000000..e89bf31f3f --- /dev/null +++ b/types/langmap/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for langmap 0.0 +// Project: https://github.com/mozilla/language-mapping-list +// Definitions by: Gábor Balogh +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +import { LanguageMappingList } from './types'; + +declare const langmap: LanguageMappingList; + +export = langmap; diff --git a/types/langmap/langmap-tests.ts b/types/langmap/langmap-tests.ts new file mode 100644 index 0000000000..76daf18956 --- /dev/null +++ b/types/langmap/langmap-tests.ts @@ -0,0 +1,13 @@ +// tslint:disable:no-duplicate-imports + +import langmap1 from 'langmap'; +import * as langmap2 from 'langmap'; + +const val1 = langmap1['en-US']; // { nativeName: string, englishName: string } +const val2 = langmap2['en-US']; // { nativeName: string, englishName: string } + +val1.englishName; +val1.nativeName; + +val2.englishName; +val2.nativeName; diff --git a/types/langmap/tsconfig.json b/types/langmap/tsconfig.json new file mode 100644 index 0000000000..3888dc0f24 --- /dev/null +++ b/types/langmap/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "esModuleInterop": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "langmap-tests.ts", + "types.d.ts" + ] +} diff --git a/types/langmap/tslint.json b/types/langmap/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/langmap/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/langmap/types.d.ts b/types/langmap/types.d.ts new file mode 100644 index 0000000000..3588199c49 --- /dev/null +++ b/types/langmap/types.d.ts @@ -0,0 +1,8 @@ +export interface Language { + englishName: string; + nativeName: string; +} + +export interface LanguageMappingList { + [language: string]: Language; +}