Skip to content

Conversation

@RoystonS
Copy link
Contributor

The TypeScript compiler splits JsDoc comments into two, and react-docgen-typescript was only pulling comment data from one of the two places. This PR rebuilds the full comment from both parts.

(Pulling the comment formation logic out into a helper method also has the effect of providing consistent handling both for null/undefined symbols when extracting comments and for whitespace-trimming.)

The TypeScript compiler helpfully splits JsDoc comments into two,
exposing the bulk of the text via symbol.getDocumentationComment()
and the JsDoc tags via symbol.getJsDocTags().

react-docgen expects to be given the full JsDoc comment including
the tags, so we need to reconstitute the full comment back again
from the parts exposed by TypeScript.

This also DRYs out the comment parsing, to make whitespace trimming
consistent.
@pvasek pvasek merged commit 7ca59cc into styleguidist:master Jun 21, 2017
@pvasek
Copy link
Collaborator

pvasek commented Jun 21, 2017

Excellent, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants