-
-
Notifications
You must be signed in to change notification settings - Fork 627
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typesafe Interpolation Variables #1897
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Still not stale |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Still not stale |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale |
Resolved by #1911? |
@CreativeTechGuy @Lesik you might want to help here: #1911 (comment) |
Please try with i18next v23.0.1 and react-i18next v13.0.0 |
|
馃殌 Feature Proposal
Enable opt-in typesafe interpolation variables. Given that the user is already using #1504, this will add additional intellisense based on the contents of the string, finding any variable placeholders and requiring values to be passed for each.
Motivation
It's easy to miss passing required interpolation variables when translating a string. This will ensure that developers get both real-time Type errors and auto complete for variable names to avoid mistakes at runtime.
Example
Example TypeScript sandbox. I wrote this code to make typesafe URL path variables and realized it could be used with very minor tweaks here too. It'd be amazing if this could be integrated into the core library.
Notes
{{name}}
) and nothing more. As a result, it needs to be opt-in as it won't work for everyone. I believe this is still valuable as simple placeholders covers a majority of users.The text was updated successfully, but these errors were encountered: