ts-simple-ast
Version:
TypeScript compiler wrapper for AST navigation and code generation.
55 lines (54 loc) • 1.77 kB
TypeScript
import { Constructor } from "./../../Constructor";
import { Node } from "./../common";
import { ModifierableNode } from "./ModifierableNode";
export declare type ExportableNodeExtensionType = Node & ModifierableNode;
export interface ExportableNode {
/**
* If the node has the export keyword.
*/
hasExportKeyword(): boolean;
/**
* Gets the export keyword or undefined if none exists.
*/
getExportKeyword(): Node | undefined;
/**
* Gets the export keyword or throws if none exists.
*/
getExportKeywordOrThrow(): Node;
/**
* If the node has the default keyword.
*/
hasDefaultKeyword(): boolean;
/**
* Gets the default keyword or undefined if none exists.
*/
getDefaultKeyword(): Node | undefined;
/**
* Gets the default keyword or throws if none exists.
*/
getDefaultKeywordOrThrow(): Node;
/**
* Gets if the node is exported from a namespace, is a default export, or is a named export.
*/
isExported(): boolean;
/**
* Gets if this node is a default export of a file.
*/
isDefaultExport(): boolean;
/**
* Gets if this node is a named export of a file.
*/
isNamedExport(): boolean;
/**
* Sets if this node is a default export of a file.
* @param value - If it should be a default export or not.
*/
setIsDefaultExport(value: boolean): this;
/**
* Sets if the node is exported.
* Note: Will always remove the default export if set.
* @param value - If it should be exported or not.
*/
setIsExported(value: boolean): this;
}
export declare function ExportableNode<T extends Constructor<ExportableNodeExtensionType>>(Base: T): Constructor<ExportableNode> & T;