UNPKG

@ts-ast-parser/core

Version:

Reflects a simplified version of the TypeScript AST for generating documentation

58 lines 1.47 kB
import { ExportKind } from '../models/export.js'; import { RootNodeType } from '../models/node.js'; /** * Represents the reflected node of an export assignment. * * For example `export default foo` or `export = class Foo {}`. */ export class ExportAssignmentNode { constructor(node, context) { Object.defineProperty(this, "_node", { enumerable: true, configurable: true, writable: true, value: void 0 }); Object.defineProperty(this, "_context", { enumerable: true, configurable: true, writable: true, value: void 0 }); this._node = node; this._context = context; } getName() { return this._node.expression.getText() ?? ''; } getOriginalName() { return this.getName(); } getNodeType() { return RootNodeType.Export; } getContext() { return this._context; } getKind() { return this._node.isExportEquals ? ExportKind.Equals : ExportKind.Default; } isTypeOnly() { return false; } getTSNode() { return this._node; } /** * Serializes the reflected node * * @returns The reflected node as a serializable object */ serialize() { return { name: this.getName(), kind: this.getKind(), }; } } //# sourceMappingURL=export-assignment-node.js.map