Skip to content

Commit a48f736

Browse files
authored
build: expose static methods and properties (#22786)
Exposes information about static members/properties in the API docs. Fixes #20270.
1 parent d239c95 commit a48f736

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

tools/dgeni/processors/categorizer.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ export class Categorizer implements Processor {
108108
classDoc.directiveMetadata = getDirectiveMetadata(classDoc);
109109
classDoc.inheritedDocs = getInheritedDocsOfClass(classDoc, this._exportSymbolsToDocsMap);
110110

111+
classDoc.methods.push(...classDoc.statics
112+
.filter(isMethod)
113+
.filter(filterDuplicateMembers) as CategorizedMethodMemberDoc[]);
114+
115+
classDoc.properties.push(...classDoc.statics
116+
.filter(isProperty)
117+
.filter(filterDuplicateMembers) as CategorizedPropertyMemberDoc[]);
118+
111119
// In case the extended document is not public, we don't want to print it in the
112120
// rendered class API doc. This causes confusion and also is not helpful as the
113121
// extended document is not part of the docs and cannot be viewed.

tools/dgeni/templates/method.template.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@
99
Deprecated
1010
</div>
1111
{%- endif -%}
12+
{%- if method.isStatic -%}
13+
<div class="docs-api-modifier-method-marker">
14+
static
15+
</div>
16+
{%- endif -%}
1217
{%- if method.isAsync -%}
13-
<div class="docs-api-async-method-marker">
18+
<div class="docs-api-modifier-method-marker">
1419
async
1520
</div>
1621
{%- endif -%}

tools/dgeni/templates/property.template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
{%- endif -%}
2828

2929
<p class="docs-api-property-name">
30-
<code>{$ property.name $}: {$ property.type $}</code>
30+
<code>{%- if property.isStatic -%}static {%- endif -%}{$ property.name $}: {$ property.type $}</code>
3131
</p>
3232
</td>
3333
<td class="docs-api-property-description">{$ property.description | marked | safe $}</td>

0 commit comments

Comments
 (0)