Skip to content
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

types: support nested keys in InterpolationMap #2140

Merged
merged 1 commit into from Feb 18, 2024

Conversation

marcalexiei
Copy link
Member

Fixes #2014

Now InterpolatorMap parse the keys retrieved via ParseInterpolationValues creating a mapped type instead of a a Record<string, unknown>.

Here is a typescript playground where all types involved are available:

  • Open Playground
  • Scroll down and edit string type on line 50 (Ret type)

From my basic test this shouldn't affect performance very much,
but I haven't conducted deep performance test so far.

Unfortunately this I haven't a real app scenario to test this since
I am not using JSONs for translation so all my values are string.

If someone with the issue could test this it would be great.

Checklist

  • only relevant code is changed (make a diff before you submit the PR)
  • run tests npm run test
  • tests are included
  • commit message and code follows the Developer's Certification of Origin

Off topic

@adrai sorry if I write here but I don't know a better place 馃槄
Thanks for the invite! I have a few ideas to share about some changes to the library and repo,
if is ok for you I'll open an issue with more details in the upcoming days.

@coveralls
Copy link

Coverage Status

coverage: 96.188%. remained the same
when pulling 801f461 on marcalexiei:feature/interpolator-map-nested
into 2f3384b on i18next:master.

@adrai adrai merged commit d7577a9 into i18next:master Feb 18, 2024
5 of 6 checks passed
@adrai
Copy link
Member

adrai commented Feb 18, 2024

thank you @marcalexiei.... it's included in v23.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TFunction types, doesn't infer nested interpolation correctly
3 participants