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

types: support stricter typechecking for returnEmptyString and returnNull #2129

Merged
merged 1 commit into from Jan 29, 2024

Conversation

hsource
Copy link
Contributor

@hsource hsource commented Jan 28, 2024

This is an adaptation of #2000 addressing the feedback and rebasing.

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

Motivation

For TypeScript users who are using key fallback (returnEmptyString or returnNull set to false), the improved type inference introduced in v23 isn't working at the moment. This PR fixes that.

Fix

Check the returnEmptyString and returnNull settings when deciding whether we can return null/empty string or fallback to the key.

Testing

Added tests; ran on a large codebase and verified it typechecked still

@coveralls
Copy link

coveralls commented Jan 28, 2024

Coverage Status

coverage: 96.214%. remained the same
when pulling e358e89 on wanderlog:harry-key-fallback
into eb1207c on i18next:master.

@hsource hsource changed the title Support stricter typechecking for returnEmptyString and returnNull types: support stricter typechecking for returnEmptyString and returnNull Jan 28, 2024
@adrai adrai merged commit 0aef924 into i18next:master Jan 29, 2024
6 checks passed
@adrai
Copy link
Member

adrai commented Jan 29, 2024

thank you....
included in v23.8.1

@hsource
Copy link
Contributor Author

hsource commented Jan 29, 2024

Thanks for the fast pulls!

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.

None yet

3 participants