UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

25 lines (24 loc) 827 B
import * as ts from "typescript"; import { Constructor } from "./../../../Constructor"; import { Node, Identifier } from "./../../common"; export declare type DeclarationNamedNodeExtensionType = Node<ts.NamedDeclaration>; export interface DeclarationNamedNode { /** * Gets the name node. */ getNameIdentifier(): Identifier | undefined; /** * Gets the name node or throws an error if it doesn't exists. */ getNameIdentifierOrThrow(): Identifier; /** * Gets the name. */ getName(): string | undefined; /** * Renames the name. * @param text - Text to set as the name. */ rename(text: string): this; } export declare function DeclarationNamedNode<T extends Constructor<DeclarationNamedNodeExtensionType>>(Base: T): Constructor<DeclarationNamedNode> & T;