Fix missing splat in react-intl types (#25046)

This commit is contained in:
Omar Diab
2018-04-17 10:36:39 -05:00
committed by Ryan Cavanaugh
parent e460cfa0a3
commit 2b5e8a5dd3
2 changed files with 15 additions and 1 deletions

View File

@@ -142,7 +142,7 @@ declare namespace ReactIntl {
interface Props extends MessageDescriptor {
values?: {[key: string]: MessageValue | JSX.Element};
tagName?: string;
children?: (formattedMessage: string[]) => React.ReactNode;
children?: (...formattedMessage: string[]) => React.ReactNode;
}
}
class FormattedMessage extends React.Component<FormattedMessage.Props> { }

View File

@@ -150,6 +150,20 @@ class SomeComponent extends React.Component<SomeComponentProps & InjectedIntlPro
{(text) => <div className="messageDiv">{text}</div>}
</FormattedMessage>
<FormattedMessage
id="test"
description="Test"
>
{(text) => <input placeholder={text} />}
</FormattedMessage>
<FormattedMessage
id="test"
description="Test"
>
{(...text) => <ul>{text.map(t => <li>{t}</li>)}</ul>}
</FormattedMessage>
<FormattedHTMLMessage
id="test"
description="Test"