mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
react-i18next: allow React.ReactNode as I18nextProvider's children and I18n's render function return value (#27895)
This commit is contained in:
committed by
Sheetal Nandi
parent
a0eb795fa9
commit
afa361b2b7
Vendored
+1
@@ -3,6 +3,7 @@
|
||||
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
|
||||
// Simon Baumann <https://github.com/chnoch>
|
||||
// Benedict Etzel <https://github.com/beheh>
|
||||
// Wu Haotian <https://github.com/whtsky>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -15,7 +15,7 @@ export interface i18nProps {
|
||||
i18n?: i18n;
|
||||
initialI18nStore?: any;
|
||||
initialLanguage?: string;
|
||||
children: (t: TranslationFunction, options: Options) => JSX.Element;
|
||||
children: (t: TranslationFunction, options: Options) => React.ReactNode;
|
||||
}
|
||||
|
||||
export default class I18n extends React.Component<i18nProps> { }
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ export interface I18nextProviderProps {
|
||||
i18n: i18n;
|
||||
initialI18nStore?: any;
|
||||
initialLanguage?: string;
|
||||
children: JSX.Element;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export default class I18nextProvider extends React.Component<I18nextProviderProps> { }
|
||||
|
||||
@@ -107,6 +107,10 @@ class App extends React.Component {
|
||||
<App/>
|
||||
</I18nextProvider>;
|
||||
|
||||
<I18nextProvider i18n={i18n} initialLanguage={'en'} initialI18nStore={{}}>
|
||||
123
|
||||
</I18nextProvider>;
|
||||
|
||||
loadNamespaces({components: [App], i18n}).then(() => {
|
||||
}).catch(error => {
|
||||
});
|
||||
@@ -182,6 +186,10 @@ interface CustomTranslateFunctionProps {
|
||||
}
|
||||
</I18n>;
|
||||
|
||||
<I18n>
|
||||
{t => '123'}
|
||||
</I18n>;
|
||||
|
||||
const defaults: ReactI18NextOptions = {
|
||||
wait: true,
|
||||
withRef: true,
|
||||
|
||||
Reference in New Issue
Block a user