Skip to content

Commit 570b4fb

Browse files
committed
Make the strings returned by ApiItem.displayName less verbose; improve formatting of ApiItem.getScopedNameWithinPackage()
1 parent 7c249ed commit 570b4fb

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

‎apps/api-extractor-model/src/items/ApiItem.ts‎

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ export class ApiItem {
107107
*/
108108
public get displayName(): string {
109109
switch (this.kind) {
110-
case ApiItemKind.CallSignature: return '(call signature)';
110+
case ApiItemKind.CallSignature: return '(call)';
111111
case ApiItemKind.Constructor: return '(constructor)';
112-
case ApiItemKind.ConstructSignature: return '(construct signature)';
112+
case ApiItemKind.ConstructSignature: return '(new)';
113113
case ApiItemKind.IndexSignature: return '(indexer)';
114114
case ApiItemKind.Model: return '(model)';
115115
}
@@ -166,8 +166,19 @@ export class ApiItem {
166166
}
167167
if (reversedParts.length !== 0) {
168168
reversedParts.push('.');
169-
} else if (ApiParameterListMixin.isBaseClassOf(current)) { // tslint:disable-line:no-use-before-declare
170-
reversedParts.push('()');
169+
} else {
170+
switch (current.kind) {
171+
case ApiItemKind.CallSignature:
172+
case ApiItemKind.ConstructSignature:
173+
case ApiItemKind.Constructor:
174+
case ApiItemKind.IndexSignature:
175+
// These functional forms don't have a proper name, so we don't append the "()" suffix
176+
break;
177+
default:
178+
if (ApiParameterListMixin.isBaseClassOf(current)) { // tslint:disable-line:no-use-before-declare
179+
reversedParts.push('()');
180+
}
181+
}
171182
}
172183
reversedParts.push(current.displayName);
173184
}

0 commit comments

Comments
 (0)