Skip to content

Fails to parse file when using flow annotation for callback prop with parameter #206

Closed
@mmsbrggr

Description

@mmsbrggr

The following file cannot be parsed:

export default class Option extends React.PureComponent {
    props: {
        selected: boolean,
        disabled: boolean,
        focus: boolean,
        value: string,
        children?: string,
        onClick?: (string) => void,
    };
    ...
}

I am using react-docgen indirectly through styleguidist. The following error message is output:
Cannot parse .../Option.js: TypeError: Cannot read property 'indent' of undefined

I guess that the issue has something to do with the onClick type annotation (string) => void, because if I change it to (value: string) => void it works again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions