react-docgen icon indicating copy to clipboard operation
react-docgen copied to clipboard

fix(ts): parse prop types if component inhereited from a HOC

Open mfazekas opened this issue 3 years ago • 0 comments

Supports doc generation for the following, pattern:

function MyHoc<T>(v: React.Component<T>) : React.Component<T> {
	return v;
}

interface Props {
  ...
}

class MyComponent extends MyHoc(React.Component<Props>) {
  render() {
    return <div className='s-c-z-example'/>;
  }
}

It's only a heuristic, and has the assumption that a function call in extends is a HOC and the first argument to Hoc is a React.Component like thing.

Note sure I this is something you'd support or if this implementation is ok or not.

mfazekas avatar Oct 08 '22 12:10 mfazekas