UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

43 lines (42 loc) 2.4 kB
import * as ts from "typescript"; import { Node } from "./../common"; import { FunctionDeclarationOverloadStructure, FunctionDeclarationStructure } from "./../../structures"; import { NamedNode, ModifierableNode, ExportableNode, AmbientableNode, AsyncableNode, GeneratorableNode, BodyableNode, TextInsertableNode } from "./../base"; import { StatementedNode } from "./../statement"; import { NamespaceChildableNode } from "./../namespace"; import { FunctionLikeDeclaration } from "./FunctionLikeDeclaration"; import { OverloadableNode } from "./OverloadableNode"; export declare const FunctionDeclarationBase: (new (...args: any[]) => TextInsertableNode) & (new (...args: any[]) => OverloadableNode) & (new (...args: any[]) => BodyableNode) & (new (...args: any[]) => AsyncableNode) & (new (...args: any[]) => GeneratorableNode) & (new (...args: any[]) => FunctionLikeDeclaration) & (new (...args: any[]) => StatementedNode) & (new (...args: any[]) => AmbientableNode) & (new (...args: any[]) => NamespaceChildableNode) & (new (...args: any[]) => ExportableNode) & (new (...args: any[]) => ModifierableNode) & (new (...args: any[]) => NamedNode) & typeof Node; export declare class FunctionDeclaration extends FunctionDeclarationBase<ts.FunctionDeclaration> { /** * Fills the node from a structure. * @param structure - Structure to fill. */ fill(structure: Partial<FunctionDeclarationStructure>): this; /** * Adds a function overload. * @param structure - Structure of the overload. */ addOverload(structure: FunctionDeclarationOverloadStructure): FunctionDeclaration; /** * Adds function overloads. * @param structures - Structures of the overloads. */ addOverloads(structures: FunctionDeclarationOverloadStructure[]): FunctionDeclaration[]; /** * Inserts a function overload. * @param index - Index to insert. * @param structure - Structure of the overload. */ insertOverload(index: number, structure: FunctionDeclarationOverloadStructure): FunctionDeclaration; /** * Inserts function overloads. * @param index - Index to insert. * @param structure - Structures of the overloads. */ insertOverloads(index: number, structures: FunctionDeclarationOverloadStructure[]): FunctionDeclaration[]; /** * Removes this function declaration. */ remove(): void; }