UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

59 lines (58 loc) 2.73 kB
import * as ts from "typescript"; import { Node } from "./../common"; import { VariableStatementStructure, VariableDeclarationStructure } from "./../../structures"; import { ExportableNode, ModifierableNode, AmbientableNode, JSDocableNode, ChildOrderableNode } from "./../base"; import { NamespaceChildableNode } from "./../namespace"; import { VariableDeclaration } from "./VariableDeclaration"; import { VariableDeclarationType } from "./VariableDeclarationType"; export declare const VariableStatementBase: (new (...args: any[]) => ChildOrderableNode) & (new (...args: any[]) => NamespaceChildableNode) & (new (...args: any[]) => JSDocableNode) & (new (...args: any[]) => AmbientableNode) & (new (...args: any[]) => ExportableNode) & (new (...args: any[]) => ModifierableNode) & typeof Node; export declare class VariableStatement extends VariableStatementBase<ts.VariableStatement> { /** * Get the variable declarations. */ getDeclarations(): VariableDeclaration[]; /** * Gets the variable declaration type. */ getDeclarationType(): VariableDeclarationType; /** * Gets the variable declaration type keyword. */ getDeclarationTypeKeyword(): Node; /** * Sets the variable declaration type. * @param type - Type to set. */ setDeclarationType(type: VariableDeclarationType): this; /** * Add a variable declaration to the statement. * @param structure - Structure representing the variable declaration to add. */ addDeclaration(structure: VariableDeclarationStructure): VariableDeclaration; /** * Adds variable declarations to the statement. * @param structures - Structures representing the variable declarations to add. */ addDeclarations(structures: VariableDeclarationStructure[]): VariableDeclaration[]; /** * Inserts a variable declaration at the specified index within the statement. * @param index - Index to insert. * @param structure - Structure representing the variable declaration to insert. */ insertDeclaration(index: number, structure: VariableDeclarationStructure): VariableDeclaration; /** * Inserts variable declarations at the specified index within the statement. * @param index - Index to insert. * @param structures - Structures representing the variable declarations to insert. */ insertDeclarations(index: number, structures: VariableDeclarationStructure[]): VariableDeclaration[]; /** * Fills the node from a structure. * @param structure - Structure to fill. */ fill(structure: Partial<VariableStatementStructure>): this; /** * Removes this variable statement. */ remove(): void; }