mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
🤖 Merge PR #47014 Enhance langmap types by @remcohaszing
- Types are exported in the index, as `types.d.ts` doesn’t map to an existing JavaScript file. - `esModuleInterop` was removed from `tsconfig.json` for correctness. - Tests were changed not to use `esModuleInterop` and to use `$ExpectType` annotations.
This commit is contained in:
parent
05cb7a136f
commit
2c8e8d096a
14
types/langmap/index.d.ts
vendored
14
types/langmap/index.d.ts
vendored
@ -1,11 +1,21 @@
|
||||
// Type definitions for langmap 0.0
|
||||
// Project: https://github.com/mozilla/language-mapping-list
|
||||
// Definitions by: Gábor Balogh <https://github.com/grabofus>
|
||||
// Remco Haszing <https://github.com/remcohaszing>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
import { LanguageMappingList } from './types';
|
||||
declare const langmap: langmap.LanguageMappingList;
|
||||
|
||||
declare const langmap: LanguageMappingList;
|
||||
declare namespace langmap {
|
||||
interface Language {
|
||||
englishName: string;
|
||||
nativeName: string;
|
||||
}
|
||||
|
||||
interface LanguageMappingList {
|
||||
[language: string]: Language;
|
||||
}
|
||||
}
|
||||
|
||||
export = langmap;
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
// tslint:disable:no-duplicate-imports
|
||||
import * as langmap from 'langmap';
|
||||
|
||||
import langmap1 from 'langmap';
|
||||
import * as langmap2 from 'langmap';
|
||||
// $ExpectType LanguageMappingList
|
||||
langmap;
|
||||
|
||||
const val1 = langmap1['en-US']; // { nativeName: string, englishName: string }
|
||||
const val2 = langmap2['en-US']; // { nativeName: string, englishName: string }
|
||||
// $ExpectType Language
|
||||
const value = langmap['en-US'];
|
||||
|
||||
val1.englishName;
|
||||
val1.nativeName;
|
||||
|
||||
val2.englishName;
|
||||
val2.nativeName;
|
||||
// $ExpectType string
|
||||
value.englishName;
|
||||
// $ExpectType string
|
||||
value.nativeName;
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"esModuleInterop": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
|
||||
8
types/langmap/types.d.ts
vendored
8
types/langmap/types.d.ts
vendored
@ -1,8 +0,0 @@
|
||||
export interface Language {
|
||||
englishName: string;
|
||||
nativeName: string;
|
||||
}
|
||||
|
||||
export interface LanguageMappingList {
|
||||
[language: string]: Language;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user