@@ -6,12 +6,17 @@ import {
66 withTranslation ,
77 WithTranslation as ReactI18nextWithTranslation ,
88 Translation ,
9+ FallbackNs ,
10+ UseTranslationOptions ,
11+ UseTranslationResponse ,
912} from 'react-i18next'
1013import {
1114 InitOptions ,
1215 i18n as I18NextClient ,
1316 TFunction as I18NextTFunction ,
1417 TypeOptions ,
18+ FlatNamespace ,
19+ KeyPrefix ,
1520} from 'i18next'
1621import { appWithTranslation , i18n } from './'
1722
@@ -58,12 +63,23 @@ export type InternalConfig = Omit<UserConfig, 'i18n'> &
5863 supportedLngs : string [ ]
5964 }
6065
61- export type UseTranslation = typeof useTranslation
66+ type $Tuple < T > = readonly [ T ?, ...T [ ] ] ;
67+
68+ export type UseTranslation <
69+ Ns extends FlatNamespace | $Tuple < FlatNamespace > | undefined = undefined ,
70+ KPrefix extends KeyPrefix < FallbackNs < Ns > > = undefined ,
71+ > = (
72+ ns ?: Ns ,
73+ options ?: UseTranslationOptions < KPrefix > ,
74+ ) => UseTranslationResponse < FallbackNs < Ns > , KPrefix >
6275export type AppWithTranslation = typeof appWithTranslation
6376export type TFunction = I18NextTFunction
6477export type I18n = I18NextClient
6578export type WithTranslationHocType = typeof withTranslation
66- export type WithTranslation = ReactI18nextWithTranslation
79+ export type WithTranslation <
80+ Ns extends FlatNamespace | $Tuple < FlatNamespace > | undefined = undefined ,
81+ KPrefix extends KeyPrefix < FallbackNs < Ns > > = undefined ,
82+ > = ReactI18nextWithTranslation < Ns , KPrefix >
6783export type InitPromise = Promise < TFunction >
6884export type CreateClientReturn = {
6985 i18n : I18n
0 commit comments