You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been working on integrating i18next into my React Native project and have encountered an issue related to TypeScript typechecking. It seems that making the i18next.t function cooperate with TypeScript's typechecking for key parameters becomes challenging when the strictNullChecks option is set to false in the tsconfig.
Currently, the situation is somewhat functional but has limitations. We can successfully call i18next.t when providing the default namespace prefix, like this:
i18next.t('translation:myKey');// This works
However, attempting to call it without the namespace results in a TypeScript error:
i18next.t('myKey');// TypeScript error
I believe this limitation could pose a barrier to adoption for projects that choose to use the strictNullChecks: false option in their tsconfig. In my case, enabling this option led to thousands of errors, making it impractical. Given that, this option is a huge comfort in my opinion, especially for frontend projects.
While I understand that the current documentation outlines this behavior, I wanted to open a discussion to gather perspectives on the matter:
Do you consider improving TypeScript typechecking to work with strictNullChecks: false is a relevant feature?
What are the technical considerations and feasibility of implementing such a feature? (I have no idea how it's currently implemented)
I believe addressing this concern could benefit many projects and would appreciate any insights or feedback on this topic.
Thanks.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there,
I've been working on integrating i18next into my React Native project and have encountered an issue related to TypeScript typechecking. It seems that making the
i18next.t
function cooperate with TypeScript's typechecking for key parameters becomes challenging when the strictNullChecks option is set to false in the tsconfig.Currently, the situation is somewhat functional but has limitations. We can successfully call
i18next.t
when providing the default namespace prefix, like this:However, attempting to call it without the namespace results in a TypeScript error:
I believe this limitation could pose a barrier to adoption for projects that choose to use the
strictNullChecks: false
option in their tsconfig. In my case, enabling this option led to thousands of errors, making it impractical. Given that, this option is a huge comfort in my opinion, especially for frontend projects.While I understand that the current documentation outlines this behavior, I wanted to open a discussion to gather perspectives on the matter:
strictNullChecks: false
is a relevant feature?I believe addressing this concern could benefit many projects and would appreciate any insights or feedback on this topic.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions