UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

20 lines (19 loc) 656 B
import * as ts from "typescript"; import { Constructor } from "./../../Constructor"; import { Node } from "./../common"; export declare type BodyableNodeExtensionType = Node<ts.Node>; export interface BodyableNode { /** * Gets the body or throws an error if it doesn't exist. */ getBodyOrThrow(): Node; /** * Gets the body if it exists. */ getBody(): Node | undefined; /** * Sets the body text. A body is required to do this operation. */ setBodyText(text: string): this; } export declare function BodyableNode<T extends Constructor<BodyableNodeExtensionType>>(Base: T): Constructor<BodyableNode> & T;