@@ -33,7 +33,8 @@ import {
3333 ApiMethodSignature ,
3434 ApiConstructor ,
3535 ApiFunction ,
36- ApiReturnTypeMixin
36+ ApiReturnTypeMixin ,
37+ ApiTypeParameterListMixin
3738} from '@microsoft/api-extractor-model' ;
3839
3940import {
@@ -328,11 +329,11 @@ export class YamlDocumenter {
328329 break ;
329330 case ApiItemKind . Class :
330331 yamlItem . type = 'class' ;
331- this . _populateYamlClassOrInterface ( yamlItem , apiItem ) ;
332+ this . _populateYamlClassOrInterface ( yamlItem , apiItem as ApiClass ) ;
332333 break ;
333334 case ApiItemKind . Interface :
334335 yamlItem . type = 'interface' ;
335- this . _populateYamlClassOrInterface ( yamlItem , apiItem ) ;
336+ this . _populateYamlClassOrInterface ( yamlItem , apiItem as ApiInterface ) ;
336337 break ;
337338 case ApiItemKind . Method :
338339 case ApiItemKind . MethodSignature :
@@ -379,7 +380,27 @@ export class YamlDocumenter {
379380 return yamlItem as IYamlItem ;
380381 }
381382
382- private _populateYamlClassOrInterface ( yamlItem : Partial < IYamlItem > , apiItem : ApiDocumentedItem ) : void {
383+ private _populateYamlTypeParameters ( apiItem : ApiTypeParameterListMixin ) : IYamlParameter [ ] {
384+ const typeParameters : IYamlParameter [ ] = [ ] ;
385+ for ( const apiTypeParameter of apiItem . typeParameters ) {
386+ const typeParameter : IYamlParameter = {
387+ id : apiTypeParameter . name
388+ } ;
389+
390+ if ( apiTypeParameter . tsdocTypeParamBlock ) {
391+ typeParameter . description = this . _renderMarkdown ( apiTypeParameter . tsdocTypeParamBlock . content , apiItem ) ;
392+ }
393+
394+ if ( apiTypeParameter . constraintExcerpt ) {
395+ typeParameter . type = [ this . _linkToUidIfPossible ( apiTypeParameter . constraintExcerpt . text ) ] ;
396+ }
397+
398+ typeParameters . push ( typeParameter ) ;
399+ }
400+ return typeParameters ;
401+ }
402+
403+ private _populateYamlClassOrInterface ( yamlItem : Partial < IYamlItem > , apiItem : ApiClass | ApiInterface ) : void {
383404 if ( apiItem instanceof ApiClass ) {
384405 if ( apiItem . extendsType ) {
385406 yamlItem . extends = [ this . _linkToUidIfPossible ( apiItem . extendsType . excerpt . text ) ] ;
@@ -397,6 +418,11 @@ export class YamlDocumenter {
397418 yamlItem . extends . push ( this . _linkToUidIfPossible ( extendsType . excerpt . text ) ) ;
398419 }
399420 }
421+
422+ const typeParameters : IYamlParameter [ ] = this . _populateYamlTypeParameters ( apiItem ) ;
423+ if ( typeParameters . length ) {
424+ yamlItem . syntax = { typeParameters } ;
425+ }
400426 }
401427
402428 if ( apiItem . tsdocComment ) {
@@ -462,6 +488,14 @@ export class YamlDocumenter {
462488 if ( parameters . length ) {
463489 syntax . parameters = parameters ;
464490 }
491+
492+ if ( ApiTypeParameterListMixin . isBaseClassOf ( apiItem ) ) {
493+ const typeParameters : IYamlParameter [ ] = this . _populateYamlTypeParameters ( apiItem ) ;
494+ if ( typeParameters . length ) {
495+ syntax . typeParameters = typeParameters ;
496+ }
497+ }
498+
465499 }
466500
467501 private _populateYamlProperty ( yamlItem : Partial < IYamlItem > , apiItem : ApiPropertyItem ) : void {
0 commit comments