diff --git a/src/index.d.ts b/src/index.d.ts index 13be2aead..71c77cd14 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -72,6 +72,12 @@ export function withTranslation( component: React.ComponentType

, ) => React.ComponentType>; +export interface I18nextProviderProps { + i18n: i18next.i18n; +} + +export const I18nextProvider: React.FunctionComponent; + export interface TranslationProps { children: ( t: i18next.TFunction, diff --git a/test/typescript/I18nextProvider.test.tsx b/test/typescript/I18nextProvider.test.tsx new file mode 100644 index 000000000..5249dc913 --- /dev/null +++ b/test/typescript/I18nextProvider.test.tsx @@ -0,0 +1,31 @@ +import i18n from 'i18next'; +import * as React from 'react'; +import { I18nextProvider, initReactI18next } from 'react-i18next'; + +i18n.use(initReactI18next).init({ + fallbackLng: 'en', + + // have a common namespace used around the full app + ns: ['translations'], + defaultNS: 'translations', + + debug: true, + + interpolation: { + escapeValue: false, // not needed for react!! + }, + + react: { + wait: true, + }, +}); + +function test() { + return ( + Loading

}> + +

Foo

+
+ + ); +}