reactjs / reactjs/react-docgen

Nested type descriptions

Open
#683 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lib new feature
Dominant language
TypeScript
Stars
3.8k
Forks
316
Avg merge
5h 7m
Merged PRs (30d)
4

Description

Sorry if this has been reported before in some form before, but is there currently support for nested type descriptions? For example, given the following structure (using Flow and react-docgen@5.3.1):

type Panel = {
	/** Panel title */
	title: string,
	/** Panel content */
	content: string,
	/** Sublevels of more Panels */
	panels: Array<Panel>
};

type Props = {
	/** One or more toggleable Panels */
	panels: Array<Panel>
}

/** Hello World! */
const Component = (props: Props) => { ... }

^ Does not generate any description for the Panel -props. Is this intentional? The output for a Panel is:

{
	"name": "signature",
	"type": "object",
	"raw": "{ ... }",
	"signature": {
		"properties": [
			{
				"key": "title",
				"value": {
					"name": "string",
					"required": true
				}
			},
			{
				"key": "content",
				"value": {
					"name": "string",
					"required": true
				}
			},
			{
				"key": "panels",
				"value": {
					"name": "Array",
					"elements": [{ "name": "Panel" }],
					"raw": "Array<Panel>",
					"required": true
				}
			}
		]
	}
}

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.

Research direction

Start by reproducing the Flow example from the issue with react-docgen@5.3.1 and inspect the generated signature for Panel. No source files or tests are named in the report; done means the nested Panel properties retain their descriptions in the generated output, with coverage for the shown structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
documentation, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.