Skip to content

Commit

Permalink
Improved rendering of class constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
pgonzal committed Sep 8, 2017
1 parent ff5a0af commit 279c1ed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions libraries/api-documenter/src/DocItemSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export class DocItem {
break;
case 'constructor':
this.kind = DocItemKind.Constructor;
this.name = 'constructor';
break;
case 'function':
this.kind = DocItemKind.Function;
Expand Down
6 changes: 4 additions & 2 deletions libraries/api-documenter/src/yaml/YamlGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
MarkupElement,
IDocElement,
IApiMethod,
IApiConstructor,
IApiParameter,
IApiProperty,
IApiEnumMember
Expand Down Expand Up @@ -195,7 +196,7 @@ export class YamlGenerator {
}

yamlItem.name = docItem.name;
yamlItem.fullName = docItem.name;
yamlItem.fullName = yamlItem.uid;
yamlItem.langs = [ 'typeScript' ];

switch (docItem.kind) {
Expand Down Expand Up @@ -228,6 +229,7 @@ export class YamlGenerator {
break;
case DocItemKind.Constructor:
yamlItem.type = 'constructor';
this._populateYamlMethod(yamlItem, docItem);
break;
case DocItemKind.Property:
yamlItem.type = 'property';
Expand All @@ -248,7 +250,7 @@ export class YamlGenerator {
}

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

const syntax: IYamlSyntax = {
Expand Down

0 comments on commit 279c1ed

Please sign in to comment.