UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

31 lines (30 loc) 1.23 kB
import { Constructor } from "./../../Constructor"; import { Node } from "./../common"; export declare type TextInsertableNodeExtensionType = Node; export interface TextInsertableNode { /** * Inserts text within the body of the node. * * WARNING: This will dispose any previously navigated descendant nodes. * @param pos - Position to insert at. * @param text - Text to insert. */ insertText(pos: number, text: string): this; /** * Replaces text within the body of the node. * * WARNING: This will dispose any previously navigated descendant nodes. * @param range - Start and end position of the text to replace. * @param text - Text to replace the range with. */ replaceText(range: [number, number], text: string): this; /** * Removes text within the body of the node. * * WARNING: This will dispose any previously navigated descendant nodes. * @param pos - Start position to remove. * @param end - End position to remove. */ removeText(pos: number, end: number): this; } export declare function TextInsertableNode<T extends Constructor<TextInsertableNodeExtensionType>>(Base: T): Constructor<TextInsertableNode> & T;