Skip to main content
Module

x/ts_morph/ts_morph.d.ts>Decorator

TypeScript Compiler API wrapper for static analysis and programmatic code changes.
Very Popular
Latest
class Decorator
extends DecoratorBase<ts.Decorator>
import { Decorator } from "https://deno.land/x/ts_morph@22.0.0/ts_morph.d.ts";

Properties

private
_getInnerExpression

Methods

addArgument(argumentText: string | WriterFunction): Node<ts.Node>

Adds an argument.

addArguments(argumentTexts: ReadonlyArray<string | WriterFunction> | WriterFunction): Node<ts.Node>[]

Adds arguments.

addTypeArgument(argumentText: string): TypeNode<ts.TypeNode>

Adds a type argument.

addTypeArguments(argumentTexts: ReadonlyArray<string>): TypeNode<ts.TypeNode>[]

Adds type arguments.

getArguments(): Node[]

Gets the decorator's arguments from its call expression.

getCallExpression(): CallExpression | undefined

Gets the call expression if a decorator factory.

getCallExpressionOrThrow(message?: string | (() => string)): CallExpression

Gets the call expression if a decorator factory, or throws.

getFullName(): string

Gets the full decorator name.

getName(): string

Gets the decorator name.

getNameNode(): Identifier

Gets the name node of the decorator.

getParent(): NodeParentType<ts.Decorator>
getParentOrThrow(message?: string | (() => string)): NonNullable<NodeParentType<ts.Decorator>>
getStructure(): DecoratorStructure

Gets the structure equivalent to this node.

getTypeArguments(): TypeNode[]

Gets the decorator's type arguments from its call expression.

insertArgument(index: number, argumentText: string | WriterFunction): Node<ts.Node>

Inserts an argument.

insertArguments(index: number, argumentTexts: ReadonlyArray<string | WriterFunction> | WriterFunction): Node<ts.Node>[]

Inserts arguments.

insertTypeArgument(index: number, argumentText: string): TypeNode<ts.TypeNode>

Inserts a type argument.

insertTypeArguments(index: number, argumentTexts: ReadonlyArray<string>): TypeNode<ts.TypeNode>[]

Inserts type arguments.

Gets if the decorator is a decorator factory.

remove(): void

Removes this decorator.

removeArgument(node: Node): this

Removes an argument based on the node.

removeArgument(index: number): this

Removes an argument based on the specified index.

removeTypeArgument(typeArg: Node): this

Removes a type argument.

removeTypeArgument(index: number): this

Removes a type argument.

set(structure: Partial<DecoratorStructure>): this

Sets the node from a structure.

setIsDecoratorFactory(isDecoratorFactory: boolean): this

Set if this decorator is a decorator factory.