mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-06 13:11:46 +00:00
[react-intl] Allow booleans and dates when formatting a message
This commit is contained in:
Vendored
+1
-1
@@ -138,7 +138,7 @@ declare namespace ReactIntl {
|
||||
}
|
||||
|
||||
interface Props extends MessageDescriptor {
|
||||
values?: {[key: string]: string | number | JSX.Element};
|
||||
values?: {[key: string]: string | number | boolean | Date | JSX.Element};
|
||||
tagName?: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,20 @@ class SomeComponent extends React.Component<SomeComponentProps & InjectedIntlPro
|
||||
values={{ count: 123 }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
defaultMessage="Hi {bool}!"
|
||||
values={{ bool: false }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
defaultMessage="Hi {date}!"
|
||||
values={{ date: new Date() }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
@@ -136,6 +150,27 @@ class SomeComponent extends React.Component<SomeComponentProps & InjectedIntlPro
|
||||
values={{ name: "bob" }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedHTMLMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
defaultMessage="Hi numbers {count}!"
|
||||
values={{ count: 123 }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedHTMLMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
defaultMessage="Hi {bool}!"
|
||||
values={{ bool: false }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedHTMLMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
defaultMessage="Hi {date}!"
|
||||
values={{ date: new Date() }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedNumber
|
||||
value={123456.78}
|
||||
format="N"
|
||||
|
||||
Reference in New Issue
Block a user