Skip to content

[react-intl] FormattedMessage children prop#24670

Merged
mhegazy merged 1 commit intoDefinitelyTyped:masterfrom
osdiab:osdiab-react-intl-formattedmessage-children
Apr 9, 2018
Merged

[react-intl] FormattedMessage children prop#24670
mhegazy merged 1 commit intoDefinitelyTyped:masterfrom
osdiab:osdiab-react-intl-formattedmessage-children

Conversation

@osdiab
Copy link
Copy Markdown
Contributor

@osdiab osdiab commented Apr 1, 2018

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

Pretty sure the argument for children should be a string[], given what formatMessages returns.

@typescript-bot
Copy link
Copy Markdown
Contributor

typescript-bot commented Apr 1, 2018

@osdiab Thank you for submitting this PR!

🔔 @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari @formatlos - please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

@typescript-bot typescript-bot added the Unmerged The author did not merge the PR when it was ready. label Apr 6, 2018
@typescript-bot
Copy link
Copy Markdown
Contributor

After 5 days, no one has reviewed the PR 😞. A maintainer will be reviewing the PR in the next few days and will either merge it or request revisions. Thank you for your patience!

@tillwolff
Copy link
Copy Markdown
Contributor

I can have a look at wednesday

@mhegazy mhegazy merged commit ea718d9 into DefinitelyTyped:master Apr 9, 2018
@brikou
Copy link
Copy Markdown
Contributor

brikou commented Apr 12, 2018

@tillwolff I really don't why formattedMessage is a string, children?: (formattedMessage: string[]) => React.ReactNode;

Is it a bug? I guess

@tillwolff
Copy link
Copy Markdown
Contributor

@brikou I dont really get your point, but when I check the react-intl code here:
https://github.com/yahoo/react-intl/blob/master/src/components/message.js#L130

Then the defintion should be children?: (...nodes: string[]) => React.ReactNode;

Would you agree to that?

@davidspiess
Copy link
Copy Markdown
Contributor

davidspiess commented Apr 16, 2018

children(...nodes); destructures the nodes string array to a string.

So the correct typings would be children?: (...nodes: string[]) => React.ReactNode;

The following valid code throws currently an error in my application as placeholder expects a string.

<FormattedMessage id="guestInfos.email.placeholder">
  {text => <Field type="email" name="email" placeholder={text} />}
</FormattedMessage>

@osdiab
Copy link
Copy Markdown
Contributor Author

osdiab commented Apr 16, 2018

Ah my bad all, misread the source. I'll make a PR now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Unmerged The author did not merge the PR when it was ready.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants