2017-07-06 81 views
1

类似ide如何帮助描述当我记录一个像这样的功能。是否可以在tsx文件中使用自定义属性文档?

/** 
* 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> 
) 

有什么办法在帮助测试属性时让它显示说明?

实例:enter image description here

enter image description here

通知底部图像在这里有 - 一些描述和顶部不会

回答

0

这已被固定打字稿2.4和1.14 VSCode:

enter image description here

VSCode 1.14附带包括TS 2.4。您可以确保TS 2.4是通过检查VSCode状态栏右下角的TS版本活跃

enter image description here

您可以在旧版本VSCode由以下these instructions也使用TS的新版本

let us know如果您遇到任何其他问题与此

+0

VSCode 1.14尚未正式发布,但您可以在内部人员的预览版本中预览它:https://code.visualstudio.com/insiders我们应该在下周发布1.14 –

0

打字稿使用JSDoc。 /* Some comment here */是无效的JSDoc。 /** Some comment here */是正确的做法。

的Bug VSCode /打字稿

超越事实的评论是错误的。有一个错误未能显示已在TypeScript/VSCode中修复的文档。

更多关于JSDOC

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

+0

都不起作用。更新了我的示例 – matthewdaniel

相关问题