UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

33 lines (32 loc) 904 B
import * as ts from "typescript"; import { Constructor } from "./../../Constructor"; import { Node } from "./../common"; import { Type } from "./../type/Type"; import { TypeNode } from "./../type/TypeNode"; export declare type TypedNodeExtensionType = Node<ts.Node & { type?: ts.TypeNode; }>; export interface TypedNode { /** * Gets the type. */ getType(): Type; /** * Gets the type node or undefined if none exists. */ getTypeNode(): TypeNode | undefined; /** * Gets the type node or throws if none exists. */ getTypeNodeOrThrow(): TypeNode; /** * Sets the type. * @param text - Text to set the type to. */ setType(text: string): this; /** * Removes the type. */ removeType(): this; } export declare function TypedNode<T extends Constructor<TypedNodeExtensionType>>(Base: T): Constructor<TypedNode> & T;