UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

53 lines (52 loc) 1.44 kB
import * as ts from "typescript"; import { Node, CallExpression, Expression, Identifier } 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 name identifier of the decorator. */ getNameIdentifier(): Identifier; /** * 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 expression. */ getExpression(): Expression<ts.LeftHandSideExpression>; /** * 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; }