UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

46 lines (45 loc) 1.42 kB
import * as ts from "typescript"; import { Constructor } from "./../../Constructor"; import { Node } from "./../common"; export declare type ArgumentedNodeExtensionType = Node<ts.Node & { arguments: ts.NodeArray<ts.Node>; }>; export interface ArgumentedNode { /** * Gets all the arguments of the node. */ getArguments(): Node[]; /** * Adds an argument. * @param argumentText - Argument text to add. */ addArgument(argumentText: string): Node; /** * Adds arguments. * @param argumentTexts - Argument texts to add. */ addArguments(argumentTexts: string[]): Node[]; /** * Inserts an argument. * @param index - Index to insert at. * @param argumentText - Argument text to insert. */ insertArgument(index: number, argumentText: string): Node; /** * Inserts arguments. * @param index - Index to insert at. * @param argumentTexts - Argument texts to insert. */ insertArguments(index: number, argumentTexts: string[]): Node[]; /** * Removes an argument. * @param arg - Argument to remove. */ removeArgument(arg: Node): this; /** * Removes an argument. * @param index - Index to remove. */ removeArgument(index: number): this; } export declare function ArgumentedNode<T extends Constructor<ArgumentedNodeExtensionType>>(Base: T): Constructor<ArgumentedNode> & T;