import { Contracts , ExtractDto } from "ts-extractor" ; import { ReferenceRenderHandler , SerializedApiDefinition } from "../contracts/serialized-api-item" ; import { BaseApiItemClass } from "../abstractions/base-api-item" ; import { ApiItemReference } from "../contracts/api-item-reference" ; import { GeneratorHelpers } from "../generator-helpers" ; export class ApiDefinitionDefault < TKind extends Contracts . ApiBaseDefinition = Contracts . ApiBaseDefinition > extends BaseApiItemClass < TKind > implements SerializedApiDefinition < TKind > { constructor ( extractedData , apiItem , private reference ) { super ( extractedData , apiItem ) ; } public get ParentItem ( ) : SerializedApiDefinition < Contracts . ApiDefinition > | undefined { if ( this . ApiItem . ParentId == null ) { return undefined ; } const apiItem = this . ExtractedData . Registry [ this . ApiItem . ParentId ] ; return GeneratorHelpers . SerializeApiDefinition ( this . ExtractedData , this . ApiItem , { Alias : apiItem . Name , Id : this . ApiItem . ParentId } ) as SerializedApiDefinition < Contracts . ApiDefinition > ; } public get Reference ( ) : ApiItemReference { return this . reference ; } public get Name ( ) : string { return this . ApiItem . Name ; } public ToText ( render = this . DefaultReferenceRenderer ) { return [ this . Name ] ; } public ToInlineText ( render ? ) { return this . ToText ( ) . join ( " " ) ; } public ToHeadingText ( ) { const name = this . Name ; return `${ this . ApiItem . ApiKind }: ${ name }` ; } }