UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

45 lines (44 loc) 1.22 kB
import * as ts from "typescript"; import { Node, CallExpression, Expression } from "./../common"; import { TypeNode } from "./../type"; export declare const DecoratorBase: typeof Node; export declare class Decorator extends DecoratorBase<ts.Decorator> { /** * Gets the decorator name. */ getName(): string; /** * Gets the full decorator name. */ getFullName(): string; /** * Gets if the decorator is a decorator factory. */ isDecoratorFactory(): boolean; /** * Gets the compiler call expression if a decorator factory. */ getCallExpression(): CallExpression | undefined; /** * Gets the decorator's arguments from its call expression. */ getArguments(): Expression[]; /** * Gets the decorator's type arguments from its call expression. */ getTypeArguments(): TypeNode[]; /** * Removes a type argument. * @param typeArg - Type argument to remove. */ removeTypeArgument(typeArg: Node): void; /** * Removes a type argument. * @param index - Index to remove. */ removeTypeArgument(index: number): void; /** * Removes this decorator. */ remove(): void; }