-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error is not assignable to type 'ReactI18NextChildren | Iterable<ReactI18NextChildren>' #1700
Comments
That's probably because of the nested key |
can be reproduced also in this test case: i18next/i18next@66e3283#diff-97e65d0ee521805ff4ac2d967b61062da8f5543569da4177ceeff689ce4463a3R142 |
Thanks for the quick reply @adrai , currently I don't have any clue why this is happening, I can try to investigate a bit 💯 |
So the temporary solution I found for this problem was fix all the "typescript errors" {
"test": "Test",
"test_2": "Test 2",
"test_form": {
"title": "title"
}
} {
"test_form": {
"label": "Test"
"label_2": "Test 2"
"title": "title"
}
} Because the problem comes from a nested key containing part of a key, for example "test" exists in "test_form" |
@marcalexiei also this one is very strange |
Having the library installed on a react 18.2 project meant that it would not want to recognize children passed as variables assuming they could be undefined.
And then also:
It was also messing in all kinds of ways with definitions for my components, not allowing me to use the spread operator to set "the rest of the props" using {...props}. It was so bothersome that I had to uninstall it. I cannot provide a small reproduction, these are all I can show about what happened to me. (Note: Please disregard if not related, but I think it is). |
🐛 Bug Report
A type issue appears in later releases of react-18next in combination with i18next where the following translations:
It will start generating the following error:
Type '{ title: string; }' is not assignable to type 'ReactI18NextChildren | Iterable'
To Reproduce
I created this code sandbox with a minimal reproduction of the issue:
https://codesandbox.io/p/sandbox/bug-report-react-i18next-7m4mzg
Expected behavior
No typing errors should appear for that use case.
In older version this was not an issue, as can be seen in the same reproduction but older versions https://codesandbox.io/p/sandbox/without-bug-report-react-i18next-gpkgmh
Oldest versions that worked:
"i18next": "23.3.0"
"react-i18next": "13.2.2"
Your Environment
The text was updated successfully, but these errors were encountered: