@@ -37,7 +37,7 @@ export function typeDeclaration(context: DefaultThemeRenderContext, type: SomeTy
3737 return (
3838 < div class = "tsd-type-declaration" >
3939 < h4 > { context . i18n . theme_type_declaration ( ) } </ h4 >
40- { context . typeDetails ( type ) }
40+ { context . typeDetails ( type , true ) }
4141 </ div >
4242 ) ;
4343 }
@@ -57,21 +57,22 @@ function shouldExpandReference(reference: ReferenceType) {
5757 return expanded . has ( target ) === false ;
5858}
5959
60- export function typeDetails ( context : DefaultThemeRenderContext , type : SomeType ) : JSX . Children {
61- return typeDetailsImpl ( context , type ) ;
60+ export function typeDetails ( context : DefaultThemeRenderContext , type : SomeType , renderAnchors : boolean ) : JSX . Children {
61+ return typeDetailsImpl ( context , type , renderAnchors ) ;
6262}
6363
6464export function typeDetailsImpl (
6565 context : DefaultThemeRenderContext ,
6666 type : SomeType ,
67+ renderAnchors : boolean ,
6768 highlighted ?: Map < string , CommentDisplayPart [ ] > ,
6869) : JSX . Children {
6970 const result = type . visit < JSX . Children > ( {
7071 array ( type ) {
71- return context . typeDetails ( type . elementType ) ;
72+ return context . typeDetails ( type . elementType , renderAnchors ) ;
7273 } ,
7374 intersection ( type ) {
74- return type . types . map ( context . typeDetails ) ;
75+ return type . types . map ( ( t ) => context . typeDetails ( t , renderAnchors ) ) ;
7576 } ,
7677 union ( type ) {
7778 const result : JSX . Children = [ ] ;
@@ -89,9 +90,9 @@ export function typeDetailsImpl(
8990 reflection ( type ) {
9091 const declaration = type . declaration ;
9192 if ( highlighted ) {
92- return highlightedDeclarationDetails ( context , declaration , highlighted ) ;
93+ return highlightedDeclarationDetails ( context , declaration , renderAnchors , highlighted ) ;
9394 }
94- return declarationDetails ( context , declaration ) ;
95+ return declarationDetails ( context , declaration , renderAnchors ) ;
9596 } ,
9697 reference ( reference ) {
9798 if ( shouldExpandReference ( reference ) ) {
@@ -103,8 +104,8 @@ export function typeDetailsImpl(
103104 // Ensure we don't go into an infinite loop here
104105 expanded . add ( target ) ;
105106 const details = target . type
106- ? typeDetailsImpl ( context , target . type )
107- : declarationDetails ( context , target ) ;
107+ ? context . typeDetails ( target . type , renderAnchors )
108+ : declarationDetails ( context , target , renderAnchors ) ;
108109 expanded . delete ( target ) ;
109110 return details ;
110111 }
@@ -121,7 +122,7 @@ export function typeDetailsImpl(
121122
122123export function typeDetailsIfUseful ( context : DefaultThemeRenderContext , type : SomeType | undefined ) : JSX . Children {
123124 if ( type && renderingTypeDetailsIsUseful ( type ) ) {
124- return context . typeDetails ( type ) ;
125+ return context . typeDetails ( type , false ) ;
125126 }
126127}
127128
@@ -150,6 +151,7 @@ function highlightedPropertyDetails(
150151function highlightedDeclarationDetails (
151152 context : DefaultThemeRenderContext ,
152153 declaration : DeclarationReflection ,
154+ renderAnchors : boolean ,
153155 highlightedProperties ?: Map < string , CommentDisplayPart [ ] > ,
154156) {
155157 return (
@@ -159,13 +161,17 @@ function highlightedDeclarationDetails(
159161 ?. map (
160162 ( child ) =>
161163 highlightedProperties ?. has ( child . name ) &&
162- renderChild ( context , child , highlightedProperties . get ( child . name ) ) ,
164+ renderChild ( context , child , renderAnchors , highlightedProperties . get ( child . name ) ) ,
163165 ) }
164166 </ ul >
165167 ) ;
166168}
167169
168- function declarationDetails ( context : DefaultThemeRenderContext , declaration : DeclarationReflection ) : JSX . Children {
170+ function declarationDetails (
171+ context : DefaultThemeRenderContext ,
172+ declaration : DeclarationReflection ,
173+ renderAnchors : boolean ,
174+ ) : JSX . Children {
169175 return (
170176 < >
171177 { context . commentSummary ( declaration ) }
@@ -191,7 +197,7 @@ function declarationDetails(context: DefaultThemeRenderContext, declaration: Dec
191197 </ li >
192198 ) }
193199 { declaration . indexSignatures ?. map ( ( index ) => renderIndexSignature ( context , index ) ) }
194- { declaration . getProperties ( ) ?. map ( ( child ) => renderChild ( context , child ) ) }
200+ { declaration . getProperties ( ) ?. map ( ( child ) => renderChild ( context , child , renderAnchors ) ) }
195201 </ ul >
196202 </ >
197203 ) ;
@@ -200,6 +206,7 @@ function declarationDetails(context: DefaultThemeRenderContext, declaration: Dec
200206function renderChild (
201207 context : DefaultThemeRenderContext ,
202208 child : DeclarationReflection ,
209+ renderAnchors : boolean ,
203210 highlight ?: CommentDisplayPart [ ] ,
204211) {
205212 if ( child . signatures ) {
@@ -208,6 +215,7 @@ function renderChild(
208215 < h5 >
209216 { ! ! child . flags . isRest && < span class = "tsd-signature-symbol" > ...</ span > }
210217 < span class = { getKindClass ( child ) } > { child . name } </ span >
218+ < a id = { child . anchor } class = "tsd-anchor" > </ a >
211219 < span class = "tsd-signature-symbol" > { ! ! child . flags . isOptional && "?" } :</ span >
212220 function
213221 </ h5 >
@@ -237,6 +245,7 @@ function renderChild(
237245 { context . reflectionFlags ( child ) }
238246 { ! ! child . flags . isRest && < span class = "tsd-signature-symbol" > ...</ span > }
239247 < span class = { getKindClass ( child ) } > { child . name } </ span >
248+ < a id = { child . anchor } class = "tsd-anchor" > </ a >
240249 < span class = "tsd-signature-symbol" >
241250 { ! ! child . flags . isOptional && "?" }
242251 { ": " }
@@ -245,7 +254,9 @@ function renderChild(
245254 </ h5 >
246255 { highlightOrComment ( child ) }
247256 { child . getProperties ( ) . some ( renderingChildIsUseful ) && (
248- < ul class = "tsd-parameters" > { child . getProperties ( ) . map ( ( c ) => renderChild ( context , c ) ) } </ ul >
257+ < ul class = "tsd-parameters" >
258+ { child . getProperties ( ) . map ( ( c ) => renderChild ( context , c , renderAnchors ) ) }
259+ </ ul >
249260 ) }
250261 </ li >
251262 ) ;
@@ -260,6 +271,7 @@ function renderChild(
260271 { context . reflectionFlags ( child . getSignature ) }
261272 < span class = "tsd-signature-keyword" > get </ span >
262273 < span class = { getKindClass ( child ) } > { child . name } </ span >
274+ < a id = { child . anchor } class = "tsd-anchor" > </ a >
263275 < span class = "tsd-signature-symbol" > (): </ span >
264276 { context . type ( child . getSignature . type ) }
265277 </ h5 >
@@ -273,6 +285,7 @@ function renderChild(
273285 { context . reflectionFlags ( child . setSignature ) }
274286 < span class = "tsd-signature-keyword" > set </ span >
275287 < span class = { getKindClass ( child ) } > { child . name } </ span >
288+ { ! child . getSignature && < a id = { child . anchor } class = "tsd-anchor" > </ a > }
276289 < span class = "tsd-signature-symbol" > (</ span >
277290 { child . setSignature . parameters ?. map ( ( item ) => (
278291 < >
0 commit comments