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

[www] API docs: render return values #8208

Merged

Conversation

stefanprobst
Copy link
Contributor

@stefanprobst stefanprobst commented Sep 16, 2018

The API docs currently do not render a function's return value defined with jsdoc @returns. This PR fixes this for the simple case where

  • a function defines one return value with @returns {type} description
  • or multiple return values with the syntax @returns {(type|type|type)] description.

What is not supported is defining multiple return values as separate @returns statements. This currently does not work because of a bug in gatsby-transformer-documentationjs: the description of each @returns statement (DocumentationJSComponentDescription nodes) has the same id and thus all return statements get the description text of the last @returns statement.
What's also not supported is more complex syntax like @returns {Array<number>}, but I think that's not used in the API docs.

Fixes #8203

Edit: Also fix two small errors in the docs.

Copy link
Contributor

@m-allanson m-allanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks @stefanprobst 👍

@m-allanson m-allanson merged commit dc1e95b into gatsbyjs:master Sep 17, 2018
@stefanprobst stefanprobst deleted the topics/api-docs-render-return branch July 8, 2019 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[www] API docs: return values not rendered
2 participants