tsx 文件中的自定义 属性 文档是否可行?

Is custom property documentation in tsx files possible?

类似于 ide 在我记录这样的函数时如何帮助描述。

/**
 * My Test fn
 * @param a - some description here
 */
function Test(a) {}

我希望 ide 在以下场景中显示描述,但除了“(JSX 属性)测试:布尔值”之外,我什么也说不出来

interface TestProps {
    /** Some comment here */
    test: boolean;
}
class TestComp extends React.Component<TestProps, any> {
    render() {
        return <span>{this.props.test}</span>
    }
}

const test = (props) => (
    <div><TestComp test={true} /></div>
)

有什么办法可以让它在帮助测试时显示描述属性?

示例:

请注意底部图片在这里有一些描述,而顶部没有

TypeScript 使用 JSDoc。 /* Some comment here */ 不是有效的 JSDoc。 /** Some comment here */ 是正确的做法。

VSCode/TypeScript 中的错误

除了评论错误的事实。存在无法显示已在 TypeScript 中修复的文档的错误 / VSCode.

关于 JSDOC 的更多信息

http://usejsdoc.org/about-getting-started.html

这已通过 TypeScript 2.4 和 VSCode 1.14 修复:

VSCode 1.14 附带 TS 2.4。您可以通过检查 VSCode 状态栏

右下角的 TS 版本来确保 TS 2.4 处于活动状态

您也可以按照 these instructions

在旧版本 VSCode 中使用新版本的 TS

如果您运行对此有任何其他问题,请let us know