Search code examples
typescriptecmascript-6visual-studio-codetsx

Is custom property documentation in tsx files possible?


Similar to how the ide helps with descriptions when i document a function like so.

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

I would like the ide to show a description in the following scenario but I cannot get it to say anything except "(JSX Attribute) test: boolean"

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

Is there any way to get it to show the description when helping out with the test property?

Examples: enter image description here

enter image description here

Notice the bottom image has -some description here and top doesn't


Solution

  • This has been fixed with TypeScript 2.4 and VSCode 1.14:

    enter image description here

    VSCode 1.14 ships with TS 2.4 included. You can make sure TS 2.4 is active by checking the TS version in the lower right corner of the VSCode status bar

    enter image description here

    You can also use a newer version of TS in an older version of VSCode by following these instructions

    Please let us know if you run into any other issues with this