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
If the description field of MessageDescriptor is an object (rather than a string) it will not be available when reading messages in a custom formatter.
Change the value of description on a FormattedMessage from "Foo" to {text: "Foo"}
Run a custom formatter which prints out the messages
The description will be missing for the given element
Expected behavior
Descriptions should support both string and object-type values (which would align with its Typescript prototype string | object) to allow for custom context to be provided such as images and group IDs.
psalv
changed the title
Description is not available to formatter unless it is a string
ts-transformer: Description is not available to formatter unless it is a string
Jan 17, 2022
Which package?
ts-transformer
Describe the bug
If the description field of
MessageDescriptor
is an object (rather than a string) it will not be available when reading messages in a custom formatter.Example
To Reproduce
Reproducible Steps/Repo
Steps to reproduce the behavior:
description
on a FormattedMessage from"Foo"
to{text: "Foo"}
Expected behavior
Descriptions should support both string and object-type values (which would align with its Typescript prototype
string | object
) to allow for custom context to be provided such as images and group IDs.Additional context
As discussed in #3363
This is where I believe the change needs to be made to support extracting objects:
formatjs/packages/ts-transformer/src/transform.ts
Line 245 in dfcf87e
The text was updated successfully, but these errors were encountered: