-
-
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
My t function has the return type never
for all valid values
#1811
Comments
tl;drI had to set The IssueI found out that Someone setup the project already this way, so that's how it's been. I didn't realize it was ever done differently on other projects. I'm not an Deep ExplanationBecause of this, the type system was getting messed up: Key extends `${infer K1}${_KeySeparator}${infer RestKey}`
? ParseTReturn<RestKey, Res[K1 & keyof Res], TOpt>
: // Process plurals only if count is provided inside options This check in That leads us to this point in the type: Res extends readonly unknown[]
? // ...
: Res[Key & keyof Res] The issue is that |
@marcalexiei can you confirm? If so, we can add a hint in the docs... |
The code sandbox link is not working: it leads to a 404 page even if I'm logged in.
I am using i18next from more than 2 years and I always put all types related configuration inside
There is a "Typescript" entry in the left navigation
There is a table with all available options and their default in the list of
Without a reproduction example where I can see the issue is hard understand what should be added to the documentation. |
🐛 Bug Report
This function has the type
never
even though it returns astring
(or used to, but I can't compile until I fix this):To Reproduce
A codesandbox example that doesn't actually show any text. It always returns
undefined
, but the type does shownever
.Expected behavior
It should return
string
as my translations areas const
:const translatedValue = t("table.rowexpansion.collapse")
// ^? const translatedValue: string
Your Environment
The text was updated successfully, but these errors were encountered: