Skip to content

react-docgen-typescript causes styleguidist to bomb fatally if it can't parse props #27

@RoystonS

Description

@RoystonS

Hi! Thanks very much for react-docgen-styleguidist. We're making good progress on creating a living style guide for our in-house documents thanks to it!

One blocking issue, however, is the impact on styleguidist when react-docgen-typescript can't parse the props in one component: it fails catastrophically with the dreaded TypeError: Cannot read property 'methods' of null error, and prevents the entire styleguide from being generated.

Our workaround right now is to remove that component from the styleguide, but it would be really helpful to be able to have a component in the styleguide even if react-docgen-styleguidist can't figure out props for it, so we can provide examples and live views of the component.

Here's an example of one of our problematic components, where we're using glamorous to produce a simple low-level styled component:

import glamorous from 'glamorous';
import { ITheme } from './ITheme';

export const BodyText = glamorous.span({
}, (_props: any, theme: ITheme) => ({
    color: theme.bodyTextColor,
    fontSize: theme.bodyTextSize
}));

export default BodyText;

It would be unreasonable to expect react-docgen-stypescript to figure out the props for that, but it would be great if it could still advertise a BodyText component with enough data to prevent styleguidist from blowing up, allowing a BodyText.md file to be created with examples.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions