Better support for custom types

Open
#24 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
20/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
react, typescript

Research direction

No file, test, or entry point is named. Start by locating the existing custom prop-type handling and the code path that handles arrayOf, then determine how destructured imports and nested custom functions are represented. Done means both requested patterns are documented without reparsing the raw value, with coverage for the examples given.

Written by the indexing model from the issue text.

Description

improvement

This is more of a "would you be willing to accept a pull request which does this?" question than an issue of sorts. :)

I would really like to extend the functionality of "custom" types so that:

  1. We support destructured imports (Eg. PropTypes.array - note the lack of React.)
  2. We allow common react-esque prop type function patterns to be picked up with custom props in the same way that arrayOf is currently handled. (Eg. PropTypes.iterableOf(PropTypes.record(User)))

Basically I feel the library should be able to support custom user prop types in such a way we don't have to reparse the raw value which would mean anyone can easily implement simple custom prop types and create documentation from that.

Custom prop types are super useful in building a real-world app with React and so I would like to see how we can help developers document these too.

We, at Lystable, want to build an open living component docs solution and are hoping react-docgen can feature at the core!

Dominant language
TypeScript
Stars
3.8k
Forks
316
Avg merge
3h 28m
Merged PRs (30d)
6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from reactjs/react-docgen

All issues in reactjs/react-docgen

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.