UNPKG

@microsoft/api-extractor

Version:

Validate, document, and review the exported API for a TypeScript library

36 lines (34 loc) 1.38 kB
"use strict"; // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. // See LICENSE in the project root for license information. Object.defineProperty(exports, "__esModule", { value: true }); const AstItem_1 = require("./AstItem"); const AstMember_1 = require("./AstMember"); /** * This class is part of the AstItem abstract syntax tree. It represents variables * that are exported by an AstNamespace (or conceivably an AstPackage in the future). * The variables have a name, a type, and an initializer. The AstNamespace implementation * currently requires them to use a primitive type and be declared as "const". */ class AstModuleVariable extends AstMember_1.default { constructor(options) { super(options); this.kind = AstItem_1.AstItemKind.ModuleVariable; const propertySignature = options.declaration; if (propertySignature.type) { this.type = propertySignature.type.getText(); } else { this.type = ''; } this.name = propertySignature.name.getText(); if (propertySignature.initializer) { this.value = propertySignature.initializer.getText(); // value of the export } else { this.value = ''; } } } exports.default = AstModuleVariable; //# sourceMappingURL=AstModuleVariable.js.map