Skip to content

Support descriptions for oneOfType values #300

Closed
@cangoektas

Description

@cangoektas

Hi there 👋

I was digging through the code looking for ways to annotate propType values and found out that (luckily!) there's already support for that. As far as I can see, propType values can be annotated for values of:

What do you think about adding support for oneOfType to that list? I'd also like to work on that if there's not a strong argument against it 🙂


Update

Whoops! Sorry, I think I misread the current state. Nested descriptions currently seem to be only supported for properties of shape, like this:

{
  icon: PropTypes.shape({
    /** Name of the icon */
    name: PropTypes.string
  })
}

Now, to be a bit more specific, what I would like to enable is the following:

{
  icon: PropTypes.oneOfType([
    /** Name of the icon */
    PropTypes.string,
    /** Icon element to render */
    PropTypes.element
  ])
}

What do you think?

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