Skip to content

Commit 279c1ed

Browse files
committed
Improved rendering of class constructors
1 parent ff5a0af commit 279c1ed

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎libraries/api-documenter/src/DocItemSet.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export class DocItem {
8282
break;
8383
case 'constructor':
8484
this.kind = DocItemKind.Constructor;
85+
this.name = 'constructor';
8586
break;
8687
case 'function':
8788
this.kind = DocItemKind.Function;

‎libraries/api-documenter/src/yaml/YamlGenerator.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
MarkupElement,
1010
IDocElement,
1111
IApiMethod,
12+
IApiConstructor,
1213
IApiParameter,
1314
IApiProperty,
1415
IApiEnumMember
@@ -195,7 +196,7 @@ export class YamlGenerator {
195196
}
196197

197198
yamlItem.name = docItem.name;
198-
yamlItem.fullName = docItem.name;
199+
yamlItem.fullName = yamlItem.uid;
199200
yamlItem.langs = [ 'typeScript' ];
200201

201202
switch (docItem.kind) {
@@ -228,6 +229,7 @@ export class YamlGenerator {
228229
break;
229230
case DocItemKind.Constructor:
230231
yamlItem.type = 'constructor';
232+
this._populateYamlMethod(yamlItem, docItem);
231233
break;
232234
case DocItemKind.Property:
233235
yamlItem.type = 'property';
@@ -248,7 +250,7 @@ export class YamlGenerator {
248250
}
249251

250252
private _populateYamlMethod(yamlItem: Partial<IYamlItem>, docItem: DocItem): void {
251-
const apiMethod: IApiMethod = docItem.apiItem as IApiMethod;
253+
const apiMethod: IApiMethod | IApiConstructor = docItem.apiItem as IApiMethod;
252254
yamlItem.name = RenderingHelpers.getConciseSignature(docItem.name, apiMethod);
253255

254256
const syntax: IYamlSyntax = {

0 commit comments

Comments
 (0)