mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
[react-native-i18n] Add type for react-native-i18n module (#24790)
* Add type for react-native-i18n * Fix tests with correct typescript version
This commit is contained in:
committed by
Mohamed Hegazy
parent
d4cb87d64d
commit
13a7c42013
11
types/react-native-i18n/index.d.ts
vendored
Normal file
11
types/react-native-i18n/index.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
// Type definitions for react-native-i18n 2.0
|
||||
// Project: https://github.com/AlexanderZaytsev/react-native-i18n
|
||||
// Definitions by: Vincent Langlet <https://github.com/VincentLanglet>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import I18n = require("i18n-js");
|
||||
|
||||
export function getLanguages(): Promise<string[]>;
|
||||
|
||||
export default I18n;
|
||||
10
types/react-native-i18n/react-native-i18n-tests.ts
Normal file
10
types/react-native-i18n/react-native-i18n-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import I18n, { getLanguages } from 'react-native-i18n';
|
||||
|
||||
getLanguages().then(languages => languages[0]);
|
||||
|
||||
I18n.defaultLocale = 'en';
|
||||
I18n.fallbacks = true;
|
||||
I18n.translations = {};
|
||||
I18n.locale = 'fr';
|
||||
|
||||
const currentLocale: string = I18n.currentLocale();
|
||||
23
types/react-native-i18n/tsconfig.json
Normal file
23
types/react-native-i18n/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-native-i18n-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/react-native-i18n/tslint.json
Normal file
1
types/react-native-i18n/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user