-
-
Notifications
You must be signed in to change notification settings - Fork 624
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
types: use unknown to better infer types on nested t functions #2018
types: use unknown to better infer types on nested t functions #2018
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to see if it would work if it was a string type, but it seems that unknown type would be fine:+1:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran into this issue as well in real world application, and verified that by modifying the type $Dictionary
in node_modules/i18next/typescript/helpers.d.ts
seems to fix the issue - thanks @marcalexiei!
Are there any work-arounds before this PR is merged and released? Any ways how to overwrite those types with Typescript without using NPM package patches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems great to me! Thanks!
HI @adrai, could you please merge and release this PR when you have the chance? |
thank you @marcalexiei it's included in v23.5.0 |
While upgrading to v23 we encounter the same issue described in #2011.
The problem seems caused by
any
usage in defaultValue, interpolation map and dictionary.Changing them to
unknown
should make type infer from nestedt
work properly.We have tested this patch on our repository and it seems to be working.
Before
After
Without
CustomTypeOptions
With
CustomTypeOptions
Checklist
npm run test