I'm having trouble figuring out how to use react-i18next with typescript 4.1.
According to the docs, I should be able to do:
const { t } = useTranslation();
return <h1>{t('title')}</h1>
However, that call to t
errors:
No overload matches this call: Argument of type 'string' is not assignable to parameter of type 'never'.
What does work is using either:
useTranslation<string>()
or
useTranslation('translation')
Both of these seem unnecessary qualifications.
This seems to only be the case with typescript 4, as if I downgrade to typescript 3 the error goes away.
Is there a way to use the shorter useTranslation()
in typescript 4?