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

ts-transformer: Description is not available to formatter unless it is a string #3373

Closed
psalv opened this issue Jan 17, 2022 · 0 comments
Closed
Labels

Comments

@psalv
Copy link
Contributor

psalv commented 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

<FormattedMessage 
    defaultMessage="Foo" 
    description={{text: "Foo description", contextImage="https://foo.com"}}
/>

To Reproduce

Reproducible Steps/Repo

Steps to reproduce the behavior:

  1. Change the value of description on a FormattedMessage from "Foo" to {text: "Foo"}
  2. Run a custom formatter which prints out the messages
  3. 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.

Additional context

As discussed in #3363

This is where I believe the change needs to be made to support extracting objects:

if (name && ts.isIdentifier(name) && initializer) {

@psalv psalv added the bug label Jan 17, 2022
@psalv 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant