-
Notifications
You must be signed in to change notification settings - Fork 258
Description
JSDoc tags in comments on props (such as @ignore) are missed out by react-docgen-typescript.
Repro Case
With this component, styleguidist should be skipping property2 from the styleguide, but it's still shown.
import * as React from 'react';
interface IJsDocTagsDontWorkProps {
/**
* First property.
*/
property1: string;
/**
* Second property.
* @ignore
*/
property2: string;
}
export class JsDocTagsDontWork extends React.PureComponent<IJsDocTagsDontWorkProps, undefined> {
render() {
return <div>Hello</div>;
}
}
export default JsDocTagsDontWork;Issue
I've had a very quick poke around... I suspect that the TypeScript compiler is being 'helpful' and is splitting JsDoc comments into two: the plain text part is returned by symbol.getDocumentationComment() but it removes JsDoc tags from the result of that call: they're instead returned by symbol.getJsDocTags().
react-docgen expects to receive a full JsDoc comment containing both the plain text and the tags (which it then parses), but right now, react-docgen-typescript only returns the plain text part because it's only calling getDocumentationComment(), meaning the JsDoc tags are just dropped.
Thanks!