-
-
Notifications
You must be signed in to change notification settings - Fork 642
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
Global t does not handle arrays as defaultNS well #2118
Comments
Can you create a PR... |
I don't have enough time and knowledge to understand why the tests are failing with the above fix, sadly. I've opened a draft. |
marcalexiei
added a commit
to marcalexiei/i18next
that referenced
this issue
Jan 19, 2024
marcalexiei
added a commit
to marcalexiei/i18next
that referenced
this issue
Jan 19, 2024
7 tasks
adrai
pushed a commit
that referenced
this issue
Jan 20, 2024
Thanks @adrai and @marcalexiei for the quick fix! We appreciate it. I've opened a small enhancement to the fix in #2123 for our specific usage. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🐛 Bug Report
When setting the typescript types through
CustomTypeOptions
,defaultNS: ['custom'];
breaks the type ofi18next.t
.To Reproduce
In
test/typescript/custom-types
, changei18next.d.ts
defaultNS: 'custom';
todefaultNS: ['custom'];
which should be equivalent (fori18next-react
useTranslation.t
, it is working)(Can be found in https://github.com/EvertEt/i18next/tree/error-poc)
Expected behavior
The type/function should work as before (with one or more defaultNS)
Your Environment
Note
I wonder if
t: TFunction<[DefaultNamespace, ...Exclude<FlatNamespace, DefaultNamespace>[]]>;
should become
t: TFunction<[$FirstNamespace<DefaultNamespace>, ...Exclude<FlatNamespace, $FirstNamespace <DefaultNamespace>>[]]>;
but that might be too simplistic.
The above can be found in https://github.com/EvertEt/i18next/tree/type-fix
The text was updated successfully, but these errors were encountered: