File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -385,6 +385,25 @@ export function parseFromProgram(
385
385
return undefined ;
386
386
}
387
387
388
+ const decl = symbol . getDeclarations ( ) ;
389
+ if ( decl ) {
390
+ // @ts -ignore - Private method
391
+ const comments = ts . getJSDocCommentsAndTags ( decl [ 0 ] ) as any [ ] ;
392
+ if ( comments && comments . length === 1 ) {
393
+ const commentNode = comments [ 0 ] ;
394
+ if ( ts . isJSDoc ( commentNode ) && commentNode . comment && commentNode . tags ) {
395
+ return (
396
+ commentNode
397
+ // Full comment text
398
+ . getText ( )
399
+ // Remove markers (/**\n* */)
400
+ . replace ( / ( ^ \/ \* \* .* $ ) | ( ^ * \* \/ ) | ( ^ * \* ? ) / gm, '' )
401
+ . trim ( )
402
+ ) ;
403
+ }
404
+ }
405
+ }
406
+
388
407
const comment = ts . displayPartsToString ( symbol . getDocumentationComment ( checker ) ) ;
389
408
return comment ? comment : undefined ;
390
409
}
You can’t perform that action at this time.
0 commit comments