react-i18next: Hit typedscript error when using useTranslation hook (TS2589: Type instantiation is excessively deep and possibly infinite.)
🐛 Bug Report
Hit ts error when upgrading to a newer version of i18next.
TS2589: Type instantiation is excessively deep and possibly infinite.
To Reproduce
- minimal reproducible example.
- The project is a clean react ts template (created from
npx create-react-app i18n-issue --template typescript
) - i18next related change is in this commit
- The project is a clean react ts template (created from
- step to reproduce the error
Note:
hit this issue with following version:
- “react-i18next”: “^13.3.2”,
- “i18next”: “^23.7.1”,
if downgrade to this version, issue is gone:
- “react-i18next”: “^11.18.3”,
- “i18next”: “^21.8.16”,
Expected behavior
Project run and build fine
Your Environment
- runtime version: i.e. node v21.1.0, chrome
- i18next version: i.e. 23.7.1
- os: Mac
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Reactions: 4
- Comments: 15 (9 by maintainers)
update your typescript dependency and the error should be gone
should also work with v23.7.5 without overrides
https://github.com/henryhoo/i18next-issue/blob/109179bdf05177ffb989c8c5a50dd20d1dcf359e/package.json#L18 https://www.i18next.com/overview/typescript