@@ -97,18 +97,38 @@ export class ClassHelper {
9797 sourceFile : ts . SourceFile ,
9898 result : any ,
9999 ) : void {
100- if ( node . jsDoc ) {
101- const comment = this . jsdocParserUtil . getMainCommentOfNode (
102- node ,
103- sourceFile ,
104- ) ;
105- if ( typeof comment !== "undefined" ) {
106- const cleanedDescription =
107- this . jsdocParserUtil . parseComment ( comment ) ;
108- result . rawdescription = cleanedDescription ;
109- result . description = markedAcl ( cleanedDescription ) ;
100+ const comment = this . jsdocParserUtil . getMainCommentOfNode (
101+ node ,
102+ sourceFile ,
103+ ) ;
104+ if ( typeof comment === "string" ) {
105+ const cleanedDescription = this . jsdocParserUtil . parseComment ( comment ) ;
106+ result . rawdescription = cleanedDescription ;
107+ result . description = markedAcl ( cleanedDescription ) ;
108+ }
109+ }
110+
111+ private hasJSDocTag ( member : ts . Node , tagName : string ) : boolean {
112+ const jsdocs = this . jsdocParserUtil . getJSDocs ( member ) as any [ ] | undefined ;
113+ if ( ! jsdocs || jsdocs . length === 0 ) {
114+ return false ;
115+ }
116+
117+ for ( const doc of jsdocs ) {
118+ if ( doc ?. tagName ?. text === tagName ) {
119+ return true ;
120+ }
121+
122+ if ( doc ?. tags ) {
123+ for ( const tag of doc . tags ) {
124+ if ( tag ?. tagName ?. text === tagName ) {
125+ return true ;
126+ }
127+ }
110128 }
111129 }
130+
131+ return false ;
112132 }
113133
114134 /**
@@ -623,19 +643,7 @@ export class ClassHelper {
623643 /**
624644 * Copyright https://github.com/ng-bootstrap/ng-bootstrap
625645 */
626- const internalTags : string [ ] = [ "internal" ] ;
627- if ( member . jsDoc ) {
628- for ( const doc of member . jsDoc ) {
629- if ( doc . tags ) {
630- for ( const tag of doc . tags ) {
631- if ( internalTags . indexOf ( tag . tagName . text ) > - 1 ) {
632- return true ;
633- }
634- }
635- }
636- }
637- }
638- return false ;
646+ return this . hasJSDocTag ( member , "internal" ) ;
639647 }
640648
641649 private isPublic ( member ) : boolean {
@@ -654,19 +662,7 @@ export class ClassHelper {
654662 /**
655663 * Copyright https://github.com/ng-bootstrap/ng-bootstrap
656664 */
657- const internalTags : string [ ] = [ "hidden" ] ;
658- if ( member . jsDoc ) {
659- for ( const doc of member . jsDoc ) {
660- if ( doc . tags ) {
661- for ( const tag of doc . tags ) {
662- if ( internalTags . indexOf ( tag . tagName . text ) > - 1 ) {
663- return true ;
664- }
665- }
666- }
667- }
668- }
669- return false ;
665+ return this . hasJSDocTag ( member , "hidden" ) ;
670666 }
671667
672668 private isPipeDecorator ( decorator ) {
@@ -2037,11 +2033,7 @@ export class ClassHelper {
20372033 getRequiredField ( ) . initializer . kind !== SyntaxKind . TrueKeyword ;
20382034 }
20392035
2040- if (
2041- ! _return . description &&
2042- property . jsDoc &&
2043- property . jsDoc . length > 0
2044- ) {
2036+ if ( ! _return . description ) {
20452037 const jsdoctags = this . jsdocParserUtil . getJSDocs ( property ) ;
20462038 this . processJSDocTags ( jsdoctags , _return ) ;
20472039 this . extractAndProcessJSDocComment ( property , sourceFile , _return ) ;
0 commit comments