How to use the @microsoft/api-extractor/lib/generators/ApiModelGenerator.ApiModelGenerator.prototype function in @microsoft/api-extractor

To help you get started, we’ve selected a few @microsoft/api-extractor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github esfx / esfx / scripts / docs / patchApiExtractor.js View on Github external
super.serializeInto(jsonObject);
        jsonObject.aliasTypeTokenRange = this.aliasTypeExcerpt.tokenRange;
    }
};

// @ts-ignore
ApiTypeAlias_1.ApiTypeAlias = ApiTypeAlias;
api_extractor_model_1.ApiTypeAlias = ApiTypeAlias;

/**
 * @param {AstDeclaration} astDeclaration
 * @param {string?} exportedName
 * @param {ApiItemContainerMixin} parentApiItem
 */
// @ts-ignore
ApiModelGenerator.prototype._processApiTypeAlias = function(astDeclaration, exportedName, parentApiItem) {
    console.log("ApiModelGenerator.prototype._processApiTypeAlias");
    const name = !!exportedName ? exportedName : astDeclaration.astSymbol.localName;
    const canonicalReference = ApiTypeAlias.getCanonicalReference(name);

    let apiTypeAlias = /** @type {ApiTypeAlias?} */(parentApiItem.tryGetMember(canonicalReference));
    if (apiTypeAlias === undefined) {
      const typeAliasDeclaration = /** @type {ts.TypeAliasDeclaration} */(astDeclaration.declaration);
      const nodesToCapture = [];
      // @ts-ignore
      const aliasTypeTokenRange = ExcerptBuilder.createEmptyTokenRange();
      nodesToCapture.push({ node: typeAliasDeclaration.type, tokenRange: aliasTypeTokenRange });

      const excerptTokens = ExcerptBuilder.build({
        startingNode: astDeclaration.declaration,
        nodesToCapture
      });