Skip to content

description prop #5

Closed
Closed
@cknitt

Description

@cknitt

In react-intl, FormattedMessage accepts an optional description prop. Also (see https://github.com/yahoo/react-intl/wiki/Components#message-descriptor),

type MessageDescriptor = {
    id: string,
    defaultMessage?: string,
    description?: string | object,
};

has the optional description field, too, and the defaultMessage seems to be optional as well.

In Reason, we currently have

type message = {
  .
  "id": string,
  "defaultMessage": string,
};

How would we model the two optional fields? I think we would need a makeMessage(Descriptor) function with two optional labeled parameters.

And how do we model the fact that description may be either string or object? [@bs.unwrap] (https://bucklescript.github.io/docs/en/function.html#trick-2-polymorphic-variant-bsunwrap)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions