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

change returnNull default to false #1885

Merged
merged 4 commits into from
Jun 9, 2023
Merged

change returnNull default to false #1885

merged 4 commits into from
Jun 9, 2023

Conversation

adrai
Copy link
Member

@adrai adrai commented Dec 13, 2022

@stale
Copy link

stale bot commented Dec 21, 2022

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.

@stale stale bot added the stale label Dec 21, 2022
@stale
Copy link

stale bot commented Dec 31, 2022

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.

@stale stale bot added the stale label Dec 31, 2022
@adrai adrai added pr hold and removed stale labels Jan 2, 2023
@adrai
Copy link
Member Author

adrai commented Jan 6, 2023

Let's wait to merge this until you "verified" all ts changes.

@coveralls
Copy link

coveralls commented Jan 6, 2023

Coverage Status

coverage: 92.14%. remained the same when pulling 8091302 on returnNull-false into 3c5308e on master.

@stale
Copy link

stale bot commented Jan 16, 2023

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.

@stale stale bot added the stale label Jan 16, 2023
@adrai adrai removed the stale label Jan 16, 2023
@mr-july
Copy link

mr-july commented Jan 26, 2023

@adrai: are you aware of the problem with the codeclima check?

@adrai
Copy link
Member Author

adrai commented Jan 26, 2023

@adrai: are you aware of the problem with the codeclima check?

@mr-july was not related to this PR

@stale
Copy link

stale bot commented Feb 18, 2023

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.

@stale stale bot added the stale label Feb 18, 2023
@adrai adrai removed the stale label Feb 20, 2023
@stale
Copy link

stale bot commented Mar 18, 2023

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.

@stale stale bot added the stale label Mar 18, 2023
@adrai adrai removed the stale label Mar 18, 2023
@stale
Copy link

stale bot commented Mar 25, 2023

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.

@stale stale bot added the stale label Mar 25, 2023
@adrai adrai removed the stale label Mar 25, 2023
@stale
Copy link

stale bot commented Apr 2, 2023

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.

@stale stale bot added the stale label Apr 2, 2023
@adrai adrai removed the stale label Apr 2, 2023
@stale
Copy link

stale bot commented Apr 25, 2023

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.

@stale stale bot added the stale label Apr 25, 2023
@adrai adrai removed the stale label Apr 26, 2023
@stale
Copy link

stale bot commented May 4, 2023

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.

@stale stale bot added the stale label May 4, 2023
@adrai adrai removed the stale label May 4, 2023
@stale
Copy link

stale bot commented May 19, 2023

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.

@stale stale bot added the stale label May 19, 2023
@adrai adrai removed the stale label May 19, 2023
@adrai
Copy link
Member Author

adrai commented Jun 8, 2023

@pedrodurek maybe there is something special to be done for this? https://github.com/i18next/i18next/pull/1885/files#diff-97e65d0ee521805ff4ac2d967b61062da8f5543569da4177ceeff689ce4463a3R129

@adrai adrai mentioned this pull request Jun 8, 2023
7 tasks
@pedrodurek
Copy link
Member

Hey @adrai, omitting null from the return type will only work when the resources type is not assigned (when devs opt not to have the keys inferred). Otherwise, it'll iterate over every key and extract the actual literal value. If you move the test to test/typescript/t.test.ts it should work.
If you prefer, we can also change the types for when the resources type is defined to fallback to string if the value is null, up to you!

@adrai
Copy link
Member Author

adrai commented Jun 9, 2023

returnNull false having a key value set to null behaves like a non-existing key... so i18next at runtime returns the defaultValue or the key name...

@adrai
Copy link
Member Author

adrai commented Jun 9, 2023

I've moved the test, like you suggested... I think it's ok to have an error when using typesafe translations... (behaves like non-existing keys)

@adrai adrai merged commit ce7bea2 into master Jun 9, 2023
5 checks passed
@adrai adrai deleted the returnNull-false branch June 9, 2023 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider setting the default for returnNull to false in next major version (v23.0.0)
4 participants