Skip to main content
Version: Next 🚧

[I] DecoratorContext

Properties

PropertyTypeDescription
decoratorTargetDiagnosticTargetPoint to the decorator target
programProgram-

Methods

call()

call<T, A, R>(
decorator,
target, ...
args): R

Helper to call out to another decorator

Type Parameters

Type Parameter
T extends Type
A extends any[]
R

Parameters

ParameterTypeDescription
decorator(context, target, ...args) => ROther decorator function
targetT-
...argsAArgs to pass to other decorator function

Returns

R


getArgumentTarget()

getArgumentTarget(paramIndex): undefined | DiagnosticTarget

Function that can be used to retrieve the target for a parameter at the given index.

Parameters

ParameterTypeDescription
paramIndexnumberParameter index in the typespec

Returns

undefined | DiagnosticTarget

Example

@foo("bar", 123) -> $foo(context, target, arg0: string, arg1: number);
getArgumentTarget(0) -> target for arg0
getArgumentTarget(1) -> target for arg1