@esfx/decorators-stage1-core Package
Provides a low-level API for working with ECMAScript Stage 1 Decorators.
Installation
npm i @esfx/decorators-stage1-core
Usage
TBD
Interfaces
AccessorMemberDescriptor<T>
ClassDescriptor<T>
FieldMemberDescriptor<T>
MemberDescriptor<T>
MethodMemberDescriptor<T>
ParameterDescriptor
Functions
createClassDescriptor(target)
Declaration
export declare function createClassDescriptor<T extends Function = Function>(target: T): ClassDescriptor<T>;
Type Parameters
- T
Parameters
- target
- T
Returns
createDecorator(decorator)
Declaration
export declare function createDecorator<S extends DecoratorSignature<[]>>(decorator: S): MappedDecoratorSignature<S>;
Type Parameters
- S
Parameters
- decorator
- S
Returns
createDecoratorFactory(decorator)
Declaration
export declare function createDecoratorFactory<S extends DecoratorSignature>(decorator: S): MappedDecoratorFactorySignature<S>;
Type Parameters
- S
Parameters
- decorator
- S
Returns
createDecoratorOrDecoratorFactory(decorator)
Declaration
export declare function createDecoratorOrDecoratorFactory<S extends DecoratorSignature>(decorator: S): MappedDecoratorOrDecoratorFactorySignature<S>;
Type Parameters
- S
Parameters
- decorator
- S
Returns
createMemberDescriptor(target, propertyKey, descriptor)
Declaration
export declare function createMemberDescriptor<T = any>(target: object, propertyKey: PropertyKey, descriptor?: TypedPropertyDescriptor<T>): MemberDescriptor<T>;
Type Parameters
- T
Parameters
- target
- object
- propertyKey
- PropertyKey
- descriptor
- TypedPropertyDescriptor<T>
Returns
createParameterDescriptor(target, propertyKey, parameterIndex)
Declaration
export declare function createParameterDescriptor(target: object, propertyKey: PropertyKey, parameterIndex: number): ParameterDescriptor;
Parameters
- target
- object
- propertyKey
- PropertyKey
- parameterIndex
- number
Returns
decorate(decorators, target)
Declaration
export declare function decorate(decorators: ((target: Function) => Function | void)[], target: Function): Function;
Parameters
- decorators
- ((target: Function) => Function | void)[]
- target
- Function
Returns
decorate(decorators, target, propertyKey, descriptor)
Declaration
export declare function decorate(decorators: ((target: object, propertyKey: PropertyKey, descriptor?: PropertyDescriptor) => PropertyDescriptor | void)[], target: object, propertyKey: PropertyKey, descriptor?: PropertyDescriptor): PropertyDescriptor | void;
Parameters
- decorators
- ((target: object, propertyKey: PropertyKey, descriptor?: PropertyDescriptor) => PropertyDescriptor | void)[]
- target
- object
- propertyKey
- PropertyKey
- descriptor
- PropertyDescriptor
Returns
decorateClass(decorators, target)
Declaration
export declare function decorateClass(decorators: ((target: Function) => Function | void)[], target: Function): Function;
Parameters
- decorators
- ((target: Function) => Function | void)[]
- target
- Function
Returns
decorateMember(decorators, target, propertyKey, descriptor)
Declaration
export declare function decorateMember(decorators: ((target: object, propertyKey: PropertyKey, descriptor?: PropertyDescriptor) => PropertyDescriptor | void)[], target: object, propertyKey: PropertyKey, descriptor?: PropertyDescriptor): PropertyDescriptor | void;
Parameters
- decorators
- ((target: object, propertyKey: PropertyKey, descriptor?: PropertyDescriptor) => PropertyDescriptor | void)[]
- target
- object
- propertyKey
- PropertyKey
- descriptor
- PropertyDescriptor
Returns
getDecoratorInfoFromArguments(args)
Declaration
export declare function getDecoratorInfoFromArguments(args: ClassDecoratorArguments): ClassDescriptor;
Parameters
Returns
getDecoratorInfoFromArguments(args)
Declaration
export declare function getDecoratorInfoFromArguments(args: MemberDecoratorArguments): MemberDescriptor;
Parameters
Returns
getDecoratorInfoFromArguments(args)
Declaration
export declare function getDecoratorInfoFromArguments(args: ParameterDecoratorArguments): ParameterDescriptor;
Parameters
Returns
getDecoratorInfoFromArguments(args)
Declaration
export declare function getDecoratorInfoFromArguments(args: DecoratorArguments): DecoratorDescriptor;
Parameters
- args
- DecoratorArguments
Returns
getDecoratorInfoFromArguments(args)
Declaration
export declare function getDecoratorInfoFromArguments(args: DecoratorArguments | IArguments): DecoratorDescriptor | undefined;
Parameters
- args
- DecoratorArguments | IArguments
Returns
isAccessor(value)
Declaration
export declare function isAccessor(value: DecoratorDescriptor): value is AccessorMemberDescriptor;
Parameters
- value
- DecoratorDescriptor
Returns
isClass(value)
Declaration
export declare function isClass(value: DecoratorDescriptor): value is ClassDescriptor;
Parameters
- value
- DecoratorDescriptor
Returns
isClassDecoratorArguments(args)
Declaration
export declare function isClassDecoratorArguments(args: DecoratorArguments | IArguments | unknown[]): args is ClassDecoratorArguments;
Parameters
- args
- DecoratorArguments | IArguments | unknown[]
Returns
isDecoratorArguments(args)
Declaration
export declare function isDecoratorArguments(args: DecoratorArguments | IArguments | unknown[]): args is DecoratorArguments;
Parameters
- args
- DecoratorArguments | IArguments | unknown[]
Returns
isField(value)
Declaration
export declare function isField(value: DecoratorDescriptor): value is FieldMemberDescriptor;
Parameters
- value
- DecoratorDescriptor
Returns
isMember(value)
Declaration
export declare function isMember(value: DecoratorDescriptor): value is MemberDescriptor;
Parameters
- value
- DecoratorDescriptor
Returns
isMemberDecoratorArguments(args)
Declaration
export declare function isMemberDecoratorArguments(args: DecoratorArguments | IArguments | unknown[]): args is MemberDecoratorArguments;
Parameters
- args
- DecoratorArguments | IArguments | unknown[]
Returns
isMethod(value)
Declaration
export declare function isMethod(value: DecoratorDescriptor): value is MethodMemberDescriptor;
Parameters
- value
- DecoratorDescriptor
Returns
isNonStatic(value)
Declaration
export declare function isNonStatic(value: MemberDescriptor | ParameterDescriptor): boolean;
Parameters
- value
- MemberDescriptor | ParameterDescriptor
Returns
isParameter(value)
Declaration
export declare function isParameter(value: DecoratorDescriptor): value is ParameterDescriptor;
Parameters
- value
- DecoratorDescriptor
Returns
isParameterDecoratorArguments(args)
Declaration
export declare function isParameterDecoratorArguments(args: DecoratorArguments | IArguments | unknown[]): args is ParameterDecoratorArguments;
Parameters
- args
- DecoratorArguments | IArguments | unknown[]
Returns
isStatic(value)
Declaration
export declare function isStatic(value: MemberDescriptor | ParameterDescriptor): boolean;
Parameters
- value
- MemberDescriptor | ParameterDescriptor
Returns
Variables
defaultAccessorAttributes
Declaration
defaultAccessorAttributes: Readonly<{
enumerable: boolean;
configurable: boolean;
}>
defaultFieldAttributes
Declaration
defaultFieldAttributes: Readonly<{
enumerable: boolean;
configurable: boolean;
writable: boolean;
}>
defaultMethodAttributes
Declaration
defaultMethodAttributes: Readonly<{
enumerable: boolean;
configurable: boolean;
writable: boolean;
}>
Type Aliases
ClassDecoratorArguments
Declaration
export declare type ClassDecoratorArguments = Parameters<(target: Function) => void>;
DecoratorArguments
Declaration
export declare type DecoratorArguments = ClassDecoratorArguments | MemberDecoratorArguments | ParameterDecoratorArguments;
DecoratorDescriptor
Declaration
export declare type DecoratorDescriptor = ClassDescriptor | MemberDescriptor | ParameterDescriptor;
MemberDecoratorArguments
Declaration
export declare type MemberDecoratorArguments = Parameters<(target: object, propertyKey: PropertyKey, descriptor?: PropertyDescriptor) => void>;
ParameterDecoratorArguments
Declaration
export declare type ParameterDecoratorArguments = Parameters<(target: object, propertyKey: PropertyKey, parameterIndex: number) => void>;