Skip to content

Commit 3ca3d0a

Browse files
committed
Added workaround for extends/implements
1 parent 8bc51e5 commit 3ca3d0a

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import {
1212
IApiConstructor,
1313
IApiParameter,
1414
IApiProperty,
15-
IApiEnumMember
15+
IApiEnumMember,
16+
IApiClass,
17+
IApiInterface
1618
} from '@microsoft/api-extractor';
1719

1820
import { DocItemSet, DocItem, DocItemKind, IDocItemSetResolveResult } from '../DocItemSet';
@@ -234,9 +236,11 @@ export class YamlGenerator {
234236
break;
235237
case DocItemKind.Class:
236238
yamlItem.type = 'class';
239+
this._populateYamlStructure(yamlItem, docItem);
237240
break;
238241
case DocItemKind.Interface:
239242
yamlItem.type = 'interface';
243+
this._populateYamlStructure(yamlItem, docItem);
240244
break;
241245
case DocItemKind.Method:
242246
yamlItem.type = 'method';
@@ -264,6 +268,23 @@ export class YamlGenerator {
264268
return yamlItem as IYamlItem;
265269
}
266270

271+
private _populateYamlStructure(yamlItem: Partial<IYamlItem>, docItem: DocItem): void {
272+
const apiStructure: IApiClass | IApiInterface = docItem.apiItem as IApiClass | IApiInterface;
273+
274+
let text: string = '';
275+
276+
if (apiStructure.extends) {
277+
text += `**Extends:** \`${apiStructure.extends}\`\n\n`;
278+
}
279+
if (apiStructure.implements) {
280+
text += `**Implements:** \`${apiStructure.implements}\`\n\n`;
281+
}
282+
283+
if (text) {
284+
yamlItem.remarks = text + (yamlItem.remarks || '');
285+
}
286+
}
287+
267288
private _populateYamlMethod(yamlItem: Partial<IYamlItem>, docItem: DocItem): void {
268289
const apiMethod: IApiMethod | IApiConstructor = docItem.apiItem as IApiMethod;
269290
yamlItem.name = RenderingHelpers.getConciseSignature(docItem.name, apiMethod);

0 commit comments

Comments
 (0)