react-docgen
react-docgen copied to clipboard
A CLI and library to extract information from React component files for documentation generation purposes.
For example: Works ✅ ```typescript import { Theme } from '../themes/Theme' export interface IconProps { /** The color to use */ color?: keyof Theme['color'] } ``` Yikes! ❌ ```typescript import...
I'm playing around with the playground and noticed that if you type your component in this way `const MyComponent: React.FC = ..`, react-docgen doesn't pick up the interface in `IProps`....
Further to this discussion https://github.com/styleguidist/react-styleguidist/issues/37 If you are using [styled-components](https://www.styled-components.com), you may have a component similar to: ```js import styled, { css } from "styled-components"; import PropTypes from "prop-types"; const...
Seems like I am having issues with ES6 imports, or TypeScript itself? ``` import React from "react"; import cls from "classnames"; import { IButtonProps } from "./types"; import "./Button.scss"; const...
Currently `react-docgen` doesn't handle some more complex cases for typescript Props I help maintain [react-docgen-typescript](https://github.com/styleguidist/react-docgen-typescript/) where I recently implemented this [Here is our bustling collection of valid typescript react component...
Hello. Have you considered adding a flag that would help determine react components? Something like this: ``` import factory from 'some-component-factory'; const Component = factory(); Component.__reactComponent = true; export default...
The defaults work fine from the static `.defaultProps` property like ... ```tsx interface Props { foo?: string; } const Test: React.SFC = (props: Props) => { const { foo, ...rest...
`react-docgen` doesn't recognize the props if it's an union type: ``` type BaseProps = {| label: string, |}; type LinkButtonProps = {| ...BaseProps, href: string, target?: string, rel?: string, |};...
See: [React Native Button.js](https://github.com/facebook/react-native/blob/master/Libraries/Components/Button.js) ``` /** * TV next focus down (see documentation for the View component). * * @platform android */ nextFocusDown?: ?number, ``` gets captured as: ``` "nextFocusDown":...
# Issue when parsing a styled component react component ## Compile warning Getting the following warning: ```sh Warning: Cannot parse src/components/Input.tsx: TypeError: Got unsupported definition type. Definition must be one...