UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

41 lines (40 loc) 2.16 kB
import * as ts from "typescript"; import { MethodDeclarationOverloadStructure, MethodDeclarationStructure } from "./../../structures"; import { Node } from "./../common"; import { PropertyNamedNode, StaticableNode, AsyncableNode, GeneratorableNode, ScopedNode, DecoratableNode, BodyableNode, TextInsertableNode } from "./../base"; import { FunctionLikeDeclaration, OverloadableNode } from "./../function"; import { AbstractableNode } from "./base"; export declare const MethodDeclarationBase: (new (...args: any[]) => TextInsertableNode) & (new (...args: any[]) => OverloadableNode) & (new (...args: any[]) => BodyableNode) & (new (...args: any[]) => DecoratableNode) & (new (...args: any[]) => AbstractableNode) & (new (...args: any[]) => ScopedNode) & (new (...args: any[]) => StaticableNode) & (new (...args: any[]) => AsyncableNode) & (new (...args: any[]) => GeneratorableNode) & (new (...args: any[]) => FunctionLikeDeclaration) & (new (...args: any[]) => PropertyNamedNode) & typeof Node; export declare class MethodDeclaration extends MethodDeclarationBase<ts.MethodDeclaration> { /** * Fills the node from a structure. * @param structure - Structure to fill. */ fill(structure: Partial<MethodDeclarationStructure>): this; /** * Add a method overload. * @param structure - Structure to add. */ addOverload(structure: MethodDeclarationOverloadStructure): MethodDeclaration; /** * Add method overloads. * @param structures - Structures to add. */ addOverloads(structures: MethodDeclarationOverloadStructure[]): MethodDeclaration[]; /** * Inserts a method overload. * @param index - Index to insert at. * @param structure - Structures to insert. */ insertOverload(index: number, structure: MethodDeclarationOverloadStructure): MethodDeclaration; /** * Inserts method overloads. * @param index - Index to insert at. * @param structures - Structures to insert. */ insertOverloads(index: number, structures: MethodDeclarationOverloadStructure[]): MethodDeclaration[]; /** * Removes the method. */ remove(): void; }