-
-
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
Issue with TS 4.1 example & specific translations keys #1215
Comments
@pedrodurek Mentioning you because @jamuhl suggested it, and because you merged a TypeScript 4.1 related pull request recently! |
Hey @Thanaen, good catch! it turns out that in order to make it work with arrays like this: {
list: [{
title: 'title1'
}, {
title: 'title2'
}]
} I'm omitting all props from Array (https://github.com/i18next/react-i18next/blob/master/src/ts4.1/index.d.ts#L45), and the key "keys" is one of them. |
Okay, @pedrodurek ! I'll try not to use this key for now ! 👍 |
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. |
@jamuhl could you change the label to |
Hey @Thanaen, it should be fixed now! 🙌 |
Once microsoft/TypeScript#32063 becomes a thing, we would be able to infer the object keys for interpolation as well https://gist.github.com/pandaniell/a7000d31ec89436f4d4e4cf68ea88f0b |
Niceee, thanks for sharing it @pandaniell |
@jamuhl could you close this task? Thanks! |
Hi ! It took me a long time to answer, but thank you very much @pedrodurek for your work. :) |
@Thanaen No problem! Thank you too! 🙌 |
🐛 Bug Report
Hi !
I've tried to apply the new TS 4.1 example, but it seems to break when a there is a key named "keys" in the translations file, like this:
en.json
To Reproduce
Here is a simple repo I used to reproduce this issue: https://github.com/Thanaen/repro-react-i18n-ts-bug
Simply clone it, run 'yarn' then 'yarn lint' or 'yarn start' !
Expected behavior
I should be able to call t('home.keys') without any linting or typescript errors.
Your Environment
The text was updated successfully, but these errors were encountered: