diff --git a/package.json b/package.json index 9fee3e78e..f8329d1ea 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "eslint-plugin-jsx-a11y": "6.2.1", "eslint-plugin-react": "7.12.4", "husky": "^1.3.1", - "i18next": "^15.0.7", + "i18next": "^17.0.8", "jest": "24.1.0", "jest-cli": "24.1.0", "lint-staged": "^8.1.3", @@ -75,7 +75,7 @@ "rollup-plugin-terser": "^4.0.4", "sinon": "^7.2.3", "tslint": "^5.13.1", - "typescript": "^3.3.3", + "typescript": "^3.5.3", "yargs": "12.0.5" }, "peerDependencies": { diff --git a/src/index.d.ts b/src/index.d.ts index 10c905fc2..f548dbba2 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -1,4 +1,4 @@ -import i18next from 'i18next'; +import * as i18next from 'i18next'; import * as React from 'react'; type Omit<T, K> = Pick<T, Exclude<keyof T, K>>; @@ -11,10 +11,7 @@ export function addUsedNamespaces(namespaces: Namespace[]): void; export function getUsedNamespaces(): string[]; export function setI18n(instance: i18next.i18n): void; export function getI18n(): i18next.i18n; -export const initReactI18next: { - type: string; - init(instance: i18next.i18n): void; -}; +export const initReactI18next: i18next.ThirdPartyModule; export function composeInitialProps(ForComponent: any): (ctx: unknown) => Promise<any>; export function getInitialProps(): { initialI18nStore: { @@ -77,7 +74,7 @@ export function withTranslation( ns?: Namespace, options?: { withRef?: boolean; - } + }, ): <P extends WithTranslation>( component: React.ComponentType<P>, ) => React.ComponentType<Omit<P, keyof WithTranslation>>; diff --git a/test/typescript/I18nextProvider.test.tsx b/test/typescript/I18nextProvider.test.tsx index 5249dc913..49323fc21 100644 --- a/test/typescript/I18nextProvider.test.tsx +++ b/test/typescript/I18nextProvider.test.tsx @@ -1,8 +1,8 @@ -import i18n from 'i18next'; +import * as i18next from 'i18next'; import * as React from 'react'; import { I18nextProvider, initReactI18next } from 'react-i18next'; -i18n.use(initReactI18next).init({ +i18next.use(initReactI18next).init({ fallbackLng: 'en', // have a common namespace used around the full app @@ -23,7 +23,7 @@ i18n.use(initReactI18next).init({ function test() { return ( <React.Suspense fallback={<p>Loading</p>}> - <I18nextProvider i18n={i18n}> + <I18nextProvider i18n={i18next}> <h1>Foo</h1> </I18nextProvider> </React.Suspense>