fix(i18n) Fix translate Typescript (#11949)

This commit is contained in:
Robert Pintilii 2022-08-02 14:41:12 +03:00 committed by GitHub
parent 3960b59765
commit 22a52dafca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
import React from 'react';
import { withTranslation } from 'react-i18next';
import { WithTranslation, withTranslation } from 'react-i18next';
import i18next from './i18next';
@ -24,7 +24,7 @@ export async function changeLanguageBundle(language: string, url: string) {
* @returns {Component} The React Component which wraps {@link component} and
* enables translations in it.
*/
export function translate(component: any) {
export function translate<P extends WithTranslation>(component: React.ComponentType<P>) {
// Use the default list of namespaces.
return withTranslation([ 'main', 'languages', 'countries' ])(component);
}