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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript - Support context #2006

Closed

Conversation

pedrodurek
Copy link
Member

@pedrodurek pedrodurek commented Jul 27, 2023

Closes i18next/react-i18next#1617, i18next/react-i18next#1333, i18next/react-i18next#1541

Limitations:

  1. Context and Plurals: Currently, due to a TypeScript limitation, it's required to pass a count while using context with plurals. I still need to figure out an workaround for it.
  2. Filtering Keys Based on Context: At present, to filter appropriate keys according to the context, it is necessary to assert the context using as const to infer the proper string literal value rather than string. This'll be addressed here.

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

Checklist (for documentation change)

  • only relevant documentation part is changed (make a diff before you submit the PR)
  • motivation/reason is provided
  • commit message and code follows the Developer's Certification of Origin

@coveralls
Copy link

Coverage Status

coverage: 92.36%. remained the same when pulling f8b4036 on pedrodurek:typescript/support-context into 549ada8 on i18next:master.

@pedrodurek pedrodurek requested a review from adrai July 27, 2023 18:38
@adrai
Copy link
Member

adrai commented Jul 27, 2023

lgtm, but you're the expert ;-)
Should we wait for this to merge?

@pedrodurek
Copy link
Member Author

Yes! Let's wait, I should put a PR up for it later today

@adrai
Copy link
Member

adrai commented Jul 29, 2023

this PR is obsolete now, right?

@adrai
Copy link
Member

adrai commented Jul 29, 2023

already included in #2007 and released with v23.4.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.

Using context with Typescript doesn't seem to resolve types properly
3 participants