Fix number replacement value returning an array instead of a string #2292
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
A regression was introduced following:
interpolate
option toreact-i18n
to support custom placeholder formats #2267It was identified in another project where a test case expecting a string was failing since it was getting an array with the new
@shopify/react-i18n
version 7.1.0:Since this function is a little complex with a different return value type based on values inside the replacement dictionary, I've added 2 tests that validates the return value of
translate
.That way, I caught another issue where an empty string was returned in the array when passing a React element as the last replacement value.
Type of change
@shopify/react-i18n
Patch: Bug (non-breaking change which fixes an issue)Checklist