Skip to content

Warning in ArgumentRenderer #1667

@lyz810

Description

@lyz810

Current behavior

Version: ^11.0.8
Report warning when document has a public method in class

Warning: Failed prop type: The prop `name` is marked as required in `ArgumentRenderer`, but its value is `undefined`.

Since v10.3.0, it started to use tsx, and name props in ArgumentRenderer became a required prop:
https://github.com/styleguidist/react-styleguidist/blob/master/src/client/rsg-components/Argument/ArgumentRenderer.tsx#L18
However, the @returns param don't have a name props

To reproduce

import React from 'react';
import PropTypes from 'prop-types';

export default class Issue extends React.Component {
    static propTypes = {
        myProps: PropTypes.bool,
    };

    /**
     * Public Method
     *
     * @public
     *
     * @returns {Boolean} return a Boolean Value
     */
    somePublicMethod = () => {
        // doSomething

        return this.props.myProps;
    }

    render() {
        return 'Open console, see warnings';
    }
}

https://github.com/lyz810/styleguidist-example/blob/master/src/components/Issue.js
please open console, and check the warning printed.
Expected behavior

Don't show warning when using @returns param, or don't consider name props of ArgumentRenderer as required props.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions