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

fix: Fix types for appWithTranslation #1987

Merged
merged 1 commit into from Oct 25, 2022
Merged

fix: Fix types for appWithTranslation #1987

merged 1 commit into from Oct 25, 2022

Conversation

oddsund
Copy link
Contributor

@oddsund oddsund commented Oct 24, 2022

This PR updates the appWithTranslation generic type to fit what is sent in by the consumers of the library.
It also updates _nextI18Next in SSRConfig to be nullable, which it may be in the case of not calling serverSideTranslations in the page.
The inverse, which is how it is today, would mean that appWithTranslation always would get a _nextI18next prop, which is not guaranteed, as indicated by the various null checks and errors thrown.

This fixes #1944

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

Updated appWithTranslation generic type to fit what is sent in by the
consumers of the library.
Marks _nextI18Next in SSRConfig as possibly null, which it may be in the
case of not calling serverSideTranslations in the page.
Added a test for the updated type in the related testfile.
Removed a few redundant null checks.
@adrai adrai merged commit 73de76d into i18next:master Oct 25, 2022
@adrai
Copy link
Member

adrai commented Oct 25, 2022

will be published with the next major -> #1966

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.

Next.js 12.3.0 AppProps generic breaks appWithTranslation type
2 participants