Hi
I noticed react-i18next 8.1.0 ships its own type define for TypeScript, so for users who previous using @types/react-i18next , they have to uninstall @types/react-i18next before upgrading to version 8.1.0.
... But the type define provided in react-i18next 8.1.0 is not compatible with @types/react-i18next. For example, @types/react-i18next export InjectedTranslateProps and TranslationFunction which are both not provided by the new type define in v8.1.0, which makes it very hard for previous TypeScript users to upgrade to the new version.(Almost every file which imported react-i18next has type error w/ v8.1.0)
Since
a) (it looks like) the core developer of react-i18next does not maintain type define
b) i18next does not provide builtin type define
I think it's better to maintain the type define in DefinitelyTyped like before.
a) https://github.com/i18next/react-i18next/issues/550
b) https://github.com/i18next/i18next/issues/1115
@schettino hope you saw this issue...
Hi, thanks for raising this. With 8.1.0, I've tried to keep consistent the names for the props type definitions, in respect to the components we're using, for instance _WithNamespaces_ that extends from _WithI18n_. This approach could be good in a long term as we're having more elaborated components and features in each release. That being said, I'd like to point out that:
TranslationFunction is defined within i18next. As long as you have its types, and you probably do, you can use it directly, if needed.
_@types/react-i18next_ is based on v7 and the current version brings some redesigns on the api and some warns for the developer that are more breaking changes coming up. Thus, for whom is upgrading from v7 this would be a natural and reliable process to keep the lib updated on their projects, for now and for the future release. InjectedTranslateProps could be too generic for accomplish that.
However, I'm totally open to suggestions. Even though it's a major update, it could be possible to export those types, as I'm doing for the translate hoc. IMHO we're now covering pretty much all of the library extent, in a more reliable and ready-for-changes way, after all we had 9 releases here without having any update on DefinitelyTyped.
FWIW, I did make https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29807, but the type definitions were removed from DT after you added them here. Some of the 9 releases were actually done to fix bugs I found while writing the new type definitions :)
I should port the improvements I made to the typedefs to the typedefs here; the upstream ones are way more barebones and have too many any or effectively-any-like constructs (that is, insufficient generics)... but time...
@Kovensky That sounds great! I encourage you to file a PR here in order to have other users of the library benefit from your type improvements.