简体   繁体   English

如何使 react-styleguide 支持 JSDoc 参数的显示文档?

[英]How to make react-styleguide to support show documentation for JSDoc params?

Whatever I'm doing I'm not able to generate docs for components that uses JSDoc.无论我在做什么,我都无法为使用 JSDoc 的组件生成文档。

For eg例如

The following code:以下代码:

/**
 * @param {{name:string}} props
 * */
export function Button(props) {

}

Should show me:应该给我看:

在此处输入图片说明

To see the props I must use propTypes要查看道具,我必须使用 propTypes

Button.propTypes = {
  name: PropTypes.string,
}

So, how to make react-styleguidist to work with JSdoc (or even kind of typescript).那么,如何使react-styleguidist与 JSdoc(甚至某种打字稿)一起使用。

A working example would be appreciate.一个工作示例将不胜感激。

You can only use @param when documenting props.您只能在记录道具时使用@param。

Here you can find more about how to use JSDoc tags: https://react-styleguidist.js.org/docs/documenting.html#using-jsdoc-tags在这里你可以找到更多关于如何使用 JSDoc 标签的信息: https ://react-styleguidist.js.org/docs/documenting.html#using-jsdoc-tags

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM