mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 07:17:04 +00:00
Merge pull request #15686 from jgke/master
[react-intl] Allow using JSX elements with <FormattedMessage>
This commit is contained in:
Vendored
+3
-7
@@ -10,10 +10,6 @@
|
||||
|
||||
declare namespace ReactIntl {
|
||||
|
||||
interface Values {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
interface Locale {
|
||||
locale: string;
|
||||
fields?: { [key: string]: string },
|
||||
@@ -70,8 +66,8 @@ declare namespace ReactIntl {
|
||||
formatRelative: (value: number, options?: FormattedRelative.PropsBase & { now?: any }) => string;
|
||||
formatNumber: (value: number, options?: FormattedNumber.PropsBase) => string;
|
||||
formatPlural: (value: number, options?: FormattedPlural.Base) => keyof FormattedPlural.PropsBase;
|
||||
formatMessage: (messageDescriptor: FormattedMessage.MessageDescriptor, values?: Values) => string;
|
||||
formatHTMLMessage: (messageDescriptor: FormattedMessage.MessageDescriptor, values?: Values) => string;
|
||||
formatMessage: (messageDescriptor: FormattedMessage.MessageDescriptor, values?: {[key: string]: string}) => string;
|
||||
formatHTMLMessage: (messageDescriptor: FormattedMessage.MessageDescriptor, values?: {[key: string]: string}) => string;
|
||||
locale: string;
|
||||
formats: any;
|
||||
messages: { [id: string]: string };
|
||||
@@ -139,7 +135,7 @@ declare namespace ReactIntl {
|
||||
}
|
||||
|
||||
export interface Props extends MessageDescriptor {
|
||||
values?: Values;
|
||||
values?: {[key: string]: string | JSX.Element};
|
||||
tagName?: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,13 @@ class SomeComponent extends React.Component<SomeComponentProps & InjectedIntlPro
|
||||
values={{ name: "bob" }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
defaultMessage="Hi nested component {name}!"
|
||||
values={{ name: <p>p</p> }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedHTMLMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
|
||||
Reference in New Issue
Block a user