@@ -88,7 +88,10 @@ export function typeDetailsImpl(
8888 } ,
8989 reflection ( type ) {
9090 const declaration = type . declaration ;
91- return declarationDetails ( context , declaration , highlighted ) ;
91+ if ( highlighted ) {
92+ return highlightedDeclarationDetails ( context , declaration , highlighted ) ;
93+ }
94+ return declarationDetails ( context , declaration ) ;
9295 } ,
9396 reference ( reference ) {
9497 if ( shouldExpandReference ( reference ) ) {
@@ -100,8 +103,8 @@ export function typeDetailsImpl(
100103 // Ensure we don't go into an infinite loop here
101104 expanded . add ( target ) ;
102105 const details = target . type
103- ? typeDetailsImpl ( context , target . type , reference . highlightedProperties )
104- : declarationDetails ( context , target , reference . highlightedProperties ) ;
106+ ? typeDetailsImpl ( context , target . type )
107+ : declarationDetails ( context , target ) ;
105108 expanded . delete ( target ) ;
106109 return details ;
107110 }
@@ -144,23 +147,25 @@ function highlightedPropertyDetails(
144147 ) ;
145148}
146149
147- function declarationDetails (
150+ function highlightedDeclarationDetails (
148151 context : DefaultThemeRenderContext ,
149152 declaration : DeclarationReflection ,
150153 highlightedProperties ?: Map < string , CommentDisplayPart [ ] > ,
151- ) : JSX . Children {
152- if ( ! declaration . comment ?. hasModifier ( "@expand" ) ) {
153- return (
154- < ul class = "tsd-parameters" >
155- { declaration . children ?. map (
154+ ) {
155+ return (
156+ < ul class = "tsd-parameters" >
157+ { declaration
158+ . getProperties ( )
159+ ?. map (
156160 ( child ) =>
157161 highlightedProperties ?. has ( child . name ) &&
158162 renderChild ( context , child , highlightedProperties . get ( child . name ) ) ,
159163 ) }
160- </ ul >
161- ) ;
162- }
164+ </ ul >
165+ ) ;
166+ }
163167
168+ function declarationDetails ( context : DefaultThemeRenderContext , declaration : DeclarationReflection ) : JSX . Children {
164169 return (
165170 < >
166171 { context . commentSummary ( declaration ) }
@@ -186,9 +191,7 @@ function declarationDetails(
186191 </ li >
187192 ) }
188193 { declaration . indexSignatures ?. map ( ( index ) => renderIndexSignature ( context , index ) ) }
189- { declaration . children ?. map ( ( child ) =>
190- renderChild ( context , child , highlightedProperties ?. get ( child . name ) ) ,
191- ) }
194+ { declaration . getProperties ( ) ?. map ( ( child ) => renderChild ( context , child ) ) }
192195 </ ul >
193196 </ >
194197 ) ;
@@ -241,8 +244,8 @@ function renderChild(
241244 { context . type ( child . type ) }
242245 </ h5 >
243246 { highlightOrComment ( child ) }
244- { child . children ? .some ( renderingChildIsUseful ) && (
245- < ul class = "tsd-parameters" > { child . children . map ( ( c ) => renderChild ( context , c ) ) } </ ul >
247+ { child . getProperties ( ) . some ( renderingChildIsUseful ) && (
248+ < ul class = "tsd-parameters" > { child . getProperties ( ) . map ( ( c ) => renderChild ( context , c ) ) } </ ul >
246249 ) }
247250 </ li >
248251 ) ;
@@ -312,19 +315,20 @@ function renderIndexSignature(context: DefaultThemeRenderContext, index: Signatu
312315}
313316
314317function renderingChildIsUseful ( refl : DeclarationReflection ) {
315- if ( refl . hasComment ( ) ) return true ;
316- if (
317- refl . children ?. some ( ( child ) => {
318- if ( child . hasComment ( ) ) return true ;
319- if ( child . type ) {
320- return renderingTypeDetailsIsUseful ( child . type ) ;
321- }
322- } )
323- ) {
318+ if ( renderingThisChildIsUseful ( refl ) ) {
324319 return true ;
325320 }
326321
327- return refl . getAllSignatures ( ) . some ( ( sig ) => {
322+ return refl . getProperties ( ) . some ( renderingThisChildIsUseful ) ;
323+ }
324+
325+ function renderingThisChildIsUseful ( refl : DeclarationReflection ) {
326+ if ( refl . hasComment ( ) ) return true ;
327+
328+ const declaration = refl . type ?. type === "reflection" ? refl . type . declaration : refl ;
329+ if ( declaration . hasComment ( ) ) return true ;
330+
331+ return declaration . getAllSignatures ( ) . some ( ( sig ) => {
328332 return sig . hasComment ( ) || sig . parameters ?. some ( ( p ) => p . hasComment ( ) ) ;
329333 } ) ;
330334}
0 commit comments