Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning in ArgumentRenderer #1667

Closed
lyz810 opened this issue Aug 20, 2020 · 2 comments
Closed

Warning in ArgumentRenderer #1667

lyz810 opened this issue Aug 20, 2020 · 2 comments

Comments

@lyz810
Copy link

lyz810 commented Aug 20, 2020

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.

@sapegin
Copy link
Member

sapegin commented Aug 24, 2020

Feel free to send a pull request with a fix! 👾

@styleguidist-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 11.0.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants