Skip to content

Commit

Permalink
build: expose static methods and properties (#22786)
Browse files Browse the repository at this point in the history
Exposes information about static members/properties in the API docs.

Fixes #20270.
  • Loading branch information
crisbeto authored May 25, 2021
1 parent d239c95 commit a48f736
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
8 changes: 8 additions & 0 deletions tools/dgeni/processors/categorizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ export class Categorizer implements Processor {
classDoc.directiveMetadata = getDirectiveMetadata(classDoc);
classDoc.inheritedDocs = getInheritedDocsOfClass(classDoc, this._exportSymbolsToDocsMap);

classDoc.methods.push(...classDoc.statics
.filter(isMethod)
.filter(filterDuplicateMembers) as CategorizedMethodMemberDoc[]);

classDoc.properties.push(...classDoc.statics
.filter(isProperty)
.filter(filterDuplicateMembers) as CategorizedPropertyMemberDoc[]);

// In case the extended document is not public, we don't want to print it in the
// rendered class API doc. This causes confusion and also is not helpful as the
// extended document is not part of the docs and cannot be viewed.
Expand Down
7 changes: 6 additions & 1 deletion tools/dgeni/templates/method.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
Deprecated
</div>
{%- endif -%}
{%- if method.isStatic -%}
<div class="docs-api-modifier-method-marker">
static
</div>
{%- endif -%}
{%- if method.isAsync -%}
<div class="docs-api-async-method-marker">
<div class="docs-api-modifier-method-marker">
async
</div>
{%- endif -%}
Expand Down
2 changes: 1 addition & 1 deletion tools/dgeni/templates/property.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{%- endif -%}

<p class="docs-api-property-name">
<code>{$ property.name $}: {$ property.type $}</code>
<code>{%- if property.isStatic -%}static {%- endif -%}{$ property.name $}: {$ property.type $}</code>
</p>
</td>
<td class="docs-api-property-description">{$ property.description | marked | safe $}</td>
Expand Down

0 comments on commit a48f736

Please sign in to comment.