reactjs / reactjs/react-docgen

Typescript generic class component props not parsed

Open
#550 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Consider the example component below which is very common.
I cannot parse the props.
am i doing something incorrect here?
please copy paste in the playgrounds and try it for yourselves. https://reactcommunity.org/react-docgen/

import React, { Component } from 'react';

interface Props {
 /**
  * name of person
  */
  name: string;
}

class MyComponent<T extends Props> extends Component<T> {
  render() {
    <p>hello</p>
  }
}


export default MyComponent;

I expect to get the props parsed for this component from the interface 'Props' But no props are parsed.

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 pasting the provided TypeScript generic class component into the react-docgen playground and compare the parser output with the expected Props interface. Investigate the parsing entry point for class component props and confirm the work is done when the documented name prop is extracted.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.