Factory for class decorators
Create a class decorator function
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
MetadataKey<T, ClassDecorator>
|
Metadata key |
||
| spec |
T
|
Metadata object from the decorator function |
||
| options |
DecoratorOptions
|
optional |
Options for the decorator |
Base factory class for decorator functions
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| TARGET |
string
|
"__decoratorTarget" | static exported |
A constant to reference the target of a decoration |
Construct a new class decorator factory
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
Metadata key |
||
| spec |
T
|
Metadata object from the decorator function |
||
| options |
DecoratorOptions
|
optional |
Options for the decorator. Default to
|
Create a decorator function of the given type. Each sub class MUST implement this method.
Get the optional decoration target of a given spec
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| spec |
T
|
Metadata spec |
Set a reference to the target class or prototype for a given spec if it's an object
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| spec |
T
|
Metadata spec |
||
| target |
Object
|
Target of the decoration. It is a class or the prototype of a class. |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| val |
Readonly<V>
|
Base factory class for decorator functions |
Get the number of parameters for a given constructor or method
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| target |
Object
|
Class or the prototype |
||
| member |
string | symbol
|
optional |
Method name |
Get the qualified name of a decoration target. For example:
class MyClass
MyClass.constructor[0] // First parameter of the constructor
MyClass.myStaticProperty
MyClass.myStaticMethod()
MyClass.myStaticMethod[0] // First parameter of the myStaticMethod
MyClass.prototype.myProperty
MyClass.prototype.myMethod()
MyClass.prototype.myMethod[1] // Second parameter of myMethod
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| target |
Object
|
Class or prototype of a class |
||
| member |
string | symbol
|
optional |
Optional property/method name |
|
| descriptorOrIndex |
TypedPropertyDescriptor<any> | number
|
optional |
Optional method descriptor or parameter index |
Factory for method decorators
Create a method decorator function
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
MetadataKey<T, MethodDecorator>
|
Metadata key |
||
| spec |
T
|
Metadata object from the decorator function |
||
| options |
DecoratorOptions
|
optional |
Options for the decorator |
Factory for method level parameter decorator. For example, the following
code uses @param to declare two parameters for greet().
class MyController {
@param('name') // Parameter 0
@param('msg') // Parameter 1
greet() {}
}
Create a method decorator function
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
MetadataKey<T, MethodDecorator>
|
Metadata key |
||
| spec |
T
|
Metadata object from the decorator function |
||
| options |
DecoratorOptions
|
optional |
Options for the decorator |
Factory for parameter decorators
Create a parameter decorator function
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
MetadataKey<T, ParameterDecorator>
|
Metadata key |
||
| spec |
T
|
Metadata object from the decorator function |
||
| options |
DecoratorOptions
|
optional |
Options for the decorator |
Factory for property decorators
Create a property decorator function
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
MetadataKey<T, PropertyDecorator>
|
Metadata key |
||
| spec |
T
|
Metadata object from the decorator function |
||
| options |
DecoratorOptions
|
optional |
Options for the decorator |
Options for a decorator
Inspector for metadata applied by decorators
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| DesignTimeReflector |
NamespacedReflect
|
TSReflector | static exported |
Expose the reflector for TypeScript design-time metadata |
| Reflector |
NamespacedReflect
|
Reflector | static exported |
Expose Reflector, which is a wrapper of |
Define metadata for the given target
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
MetadataKey<T, DecoratorType>
|
Metadata key |
||
| value |
T
|
Metadata value |
||
| target |
Object
|
Target for the metadata |
||
| member |
string | symbol
|
optional |
Optional property or method name |
Get the metadata associated with the given key for all methods of the target class or prototype
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
MetadataKey<T, MethodDecorator>
|
Metadata key |
||
| target |
Object
|
Class for static methods or prototype for instance methods |
||
| options |
InspectionOptions
|
optional |
Options for inspection |
Get the metadata associated with the given key for all parameters of a given method
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
MetadataKey<T, ParameterDecorator>
|
Metadata key |
||
| target |
Object
|
Class for static methods or prototype for instance methods |
||
| methodName |
string | symbol
|
optional |
Method name. If not present, default to '' to use the constructor |
|
| options |
InspectionOptions
|
optional |
Options for inspection |
Get the metadata associated with the given key for all properties of the target class or prototype
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
MetadataKey<T, PropertyDecorator>
|
Metadata key |
||
| target |
Object
|
Class for static methods or prototype for instance methods |
||
| options |
InspectionOptions
|
optional |
Options for inspection |
Get the metadata associated with the given key for a given class
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
MetadataKey<T, ClassDecorator>
|
Metadata key |
||
| target |
Function
|
Class that contains the metadata |
||
| options |
InspectionOptions
|
optional |
Options for inspection |
Get TypeScript design time type for a method
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| target |
Object
|
Class or prototype |
||
| methodName |
string | symbol
|
Method name |
Get TypeScript design time type for a property
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| target |
Object
|
Class or prototype |
||
| propertyName |
string | symbol
|
Property name |
Get the metadata associated with the given key for a given method of the target class or prototype
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
MetadataKey<T, MethodDecorator>
|
Metadata key |
||
| target |
Object
|
Class for static methods or prototype for instance methods |
||
| methodName |
string | symbol
|
optional |
Method name. If not present, default to '' to use the constructor |
|
| options |
InspectionOptions
|
optional |
Options for inspection |
Get the metadata associated with the given key for a parameter of a given method by index
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
MetadataKey<T, ParameterDecorator>
|
Metadata key |
||
| target |
Object
|
Class for static methods or prototype for instance methods |
||
| methodName |
string | symbol
|
Method name. If not present, default to '' to use the constructor |
||
| index |
number
|
Index of the parameter, starting with 0 |
||
| options |
InspectionOptions
|
optional |
Options for inspection |
Get the metadata associated with the given key for a given property of the target class or prototype
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
MetadataKey<T, PropertyDecorator>
|
Metadata key |
||
| target |
Object
|
Class for static properties or prototype for instance properties |
||
| propertyName |
string | symbol
|
Property name |
||
| options |
InspectionOptions
|
optional |
Options for inspection |
Options for inspection
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| namespace |
undefined | string
|
optional |
: namespace to bind this reflect context |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| decorators |
(anonymous | anonymous)[] | ClassDecorator[]
|
|||
| target |
Object
|
|||
| targetKey |
string | symbol
|
optional | ||
| descriptor |
PropertyDescriptor
|
optional |
define metadata for a target class or it's property/method
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| metadataKey |
string
|
|||
| metadataValue |
any
|
|||
| target |
Object
|
|||
| propertyKey |
string | symbol
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| metadataKey |
string
|
|||
| target |
Object
|
|||
| propertyKey |
string | symbol
|
optional |
lookup metadata from a target object and its prototype chain
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| metadataKey |
string
|
|||
| target |
Object
|
|||
| propertyKey |
string | symbol
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| target |
Object
|
|||
| propertyKey |
string | symbol
|
optional |
get own metadata for a target object or it's property/method
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| metadataKey |
string
|
|||
| target |
Object
|
|||
| propertyKey |
string | symbol
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| target |
Object
|
|||
| propertyKey |
string | symbol
|
optional |
Check if the target has corresponding metadata
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| metadataKey |
string
|
Key |
||
| target |
Object
|
Target |
||
| propertyKey |
string | symbol
|
optional |
Optional property key |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| metadataKey |
string
|
|||
| target |
Object
|
|||
| propertyKey |
string | symbol
|
optional |
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| metadataKey |
string
|
|||
| metadataValue |
any
|
A strongly-typed metadata accessor via reflection
Create a strongly-typed metadata accessor
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| key |
string
|
The metadata key |
Design time metadata for a method.
| Name | Type | Default Value | Flags | Description |
|---|---|---|---|---|
| parameterTypes |
Function[]
|
exported |
An array of parameter types |
|
| returnType |
Function
|
exported |
Return type |
|
| type |
Function
|
exported |
Type of the method itself. It is |
An object mapping keys to corresponding metadata