You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With a message containing a select clause, when a IntlMessageFormat#format is called with values object that contains a string constructor as the value of the field on which the selection is done, it throws a error like this:
TypeError: Cannot read properties of undefined (reading 'length')
at formatToParts (/path/to/project/node_modules/intl-messageformat/src/formatters.js:40:13)
at formatToParts (/path/to/project/node_modules/intl-messageformat/src/formatters.js:165:39)
Desktop (please complete the following information):
OS: Ubuntu 24.04
Browser: chrome
Version: 126
Smartphone (please complete the following information):
Didn't test but doesn't really matter.
Additional context
No additional context, but on how to resolve this issue: I think it should be ok to just use Object.create(null) for objects that hold user-provided keys, but maybe maps can be used too.
The text was updated successfully, but these errors were encountered:
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.
Which package?
intl-messageformat
Describe the bug
With a message containing a select clause, when a
IntlMessageFormat#format
is called withvalues
object that contains a stringconstructor
as the value of the field on which the selection is done, it throws a error like this:To Reproduce
Codesandbox URL
https://codesandbox.io/p/sandbox/intl-messageformat-constructor-bug-y37dvk
Reproducible Steps/Repo
Steps to reproduce the behavior:
Expected behavior
The string
constructor
is alerted.Screenshots
None
Desktop (please complete the following information):
Smartphone (please complete the following information):
Didn't test but doesn't really matter.
Additional context
No additional context, but on how to resolve this issue: I think it should be ok to just use
Object.create(null)
for objects that hold user-provided keys, but maybe maps can be used too.The text was updated successfully, but these errors were encountered: