error on initializing i18nprovider
this is my code snippet
function App() {
const { t, i18n } = useTranslation();
const i18nProvider: I18nProvider = {
translate: (key: string, options?: any) => t(key, options),
changeLocale: (lang: string) => i18n.changeLanguage(lang),
getLocale: () => i18n.language,
};
This is my error
Type '(key: string, options?: any) => string | TFunctionDetailedResult<string, any>' is not assignable to type 'Translate'.
Type 'string | TFunctionDetailedResult<string, any>' is not assignable to type 'string'.
Type 'TFunctionDetailedResult<string, any>' is not assignable to type 'string'.ts(2322)
ITranslationContext.d.ts(3, 5): The expected type comes from property 'translate' which is declared here on type 'I18nProvider'
function App() {
const { t, i18n } = useTranslation();
const i18nProvider: I18nProvider = {
translate: (key: string, options?: any) => t(key, options),
changeLocale: (lang: string) => i18n.changeLanguage(lang),
getLocale: () => i18n.language,
};
This is my error
Type '(key: string, options?: any) => string | TFunctionDetailedResult<string, any>' is not assignable to type 'Translate'.
Type 'string | TFunctionDetailedResult<string, any>' is not assignable to type 'string'.
Type 'TFunctionDetailedResult<string, any>' is not assignable to type 'string'.ts(2322)
ITranslationContext.d.ts(3, 5): The expected type comes from property 'translate' which is declared here on type 'I18nProvider'
