UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for static analysis and code manipulation.

56 lines (55 loc) 2.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var utils_1 = require("../../../utils"); var base_1 = require("../base"); var callBaseSet_1 = require("../callBaseSet"); var module_1 = require("../module"); var statement_1 = require("../statement"); var callBaseGetStructure_1 = require("../callBaseGetStructure"); exports.InterfaceDeclarationBase = base_1.TypeElementMemberedNode(base_1.ChildOrderableNode(base_1.TextInsertableNode(base_1.ExtendsClauseableNode(base_1.HeritageClauseableNode(base_1.TypeParameteredNode(base_1.JSDocableNode(base_1.AmbientableNode(module_1.NamespaceChildableNode(base_1.ExportableNode(base_1.ModifierableNode(base_1.NamedNode(statement_1.Statement)))))))))))); var InterfaceDeclaration = /** @class */ (function (_super) { tslib_1.__extends(InterfaceDeclaration, _super); function InterfaceDeclaration() { return _super !== null && _super.apply(this, arguments) || this; } /** * Gets the base types. */ InterfaceDeclaration.prototype.getBaseTypes = function () { return this.getType().getBaseTypes(); }; /** * Gets the base declarations. */ InterfaceDeclaration.prototype.getBaseDeclarations = function () { return utils_1.ArrayUtils.flatten(this.getType().getBaseTypes().map(function (t) { var symbol = t.getSymbol(); return symbol == null ? [] : symbol.getDeclarations(); })); }; /** * Gets all the implementations of the interface. * * This is similar to "go to implementation." */ InterfaceDeclaration.prototype.getImplementations = function () { return this.getNameNode().getImplementations(); }; /** * Sets the node from a structure. * @param structure - Structure to set the node with. */ InterfaceDeclaration.prototype.set = function (structure) { callBaseSet_1.callBaseSet(exports.InterfaceDeclarationBase.prototype, this, structure); return this; }; /** * Gets the structure equivalent to this node. */ InterfaceDeclaration.prototype.getStructure = function () { return callBaseGetStructure_1.callBaseGetStructure(exports.InterfaceDeclarationBase.prototype, this, {}); }; return InterfaceDeclaration; }(exports.InterfaceDeclarationBase)); exports.InterfaceDeclaration = InterfaceDeclaration;