@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
    ClassDescriptor<T>

    createDecorator(decorator)

    Declaration
    export declare function createDecorator<S extends DecoratorSignature<[]>>(decorator: S): MappedDecoratorSignature<S>;
    Type Parameters
    S

    Parameters
    decorator
    S

    Returns
    MappedDecoratorSignature<S>

    createDecoratorFactory(decorator)

    Declaration
    export declare function createDecoratorFactory<S extends DecoratorSignature>(decorator: S): MappedDecoratorFactorySignature<S>;
    Type Parameters
    S

    Parameters
    decorator
    S

    Returns
    MappedDecoratorFactorySignature<S>

    createDecoratorOrDecoratorFactory(decorator)

    Declaration
    export declare function createDecoratorOrDecoratorFactory<S extends DecoratorSignature>(decorator: S): MappedDecoratorOrDecoratorFactorySignature<S>;
    Type Parameters
    S

    Parameters
    decorator
    S

    Returns
    MappedDecoratorOrDecoratorFactorySignature<S>

    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
    MemberDescriptor<T>

    createParameterDescriptor(target, propertyKey, parameterIndex)

    Declaration
    export declare function createParameterDescriptor(target: object, propertyKey: PropertyKey, parameterIndex: number): ParameterDescriptor;
    Parameters
    target
    object

    propertyKey
    PropertyKey

    parameterIndex
    number

    Returns
    ParameterDescriptor

    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
    Function

    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
    PropertyDescriptor | void

    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
    Function

    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
    PropertyDescriptor | void

    getDecoratorInfoFromArguments(args)

    Declaration
    export declare function getDecoratorInfoFromArguments(args: ClassDecoratorArguments): ClassDescriptor;
    Parameters
    args
    ClassDecoratorArguments

    Returns
    ClassDescriptor

    getDecoratorInfoFromArguments(args)

    Declaration
    export declare function getDecoratorInfoFromArguments(args: MemberDecoratorArguments): MemberDescriptor;
    Parameters
    args
    MemberDecoratorArguments

    Returns
    MemberDescriptor

    getDecoratorInfoFromArguments(args)

    Declaration
    export declare function getDecoratorInfoFromArguments(args: ParameterDecoratorArguments): ParameterDescriptor;
    Parameters
    args
    ParameterDecoratorArguments

    Returns
    ParameterDescriptor

    getDecoratorInfoFromArguments(args)

    Declaration
    export declare function getDecoratorInfoFromArguments(args: DecoratorArguments): DecoratorDescriptor;
    Parameters
    args
    DecoratorArguments

    Returns
    DecoratorDescriptor

    getDecoratorInfoFromArguments(args)

    Declaration
    export declare function getDecoratorInfoFromArguments(args: DecoratorArguments | IArguments): DecoratorDescriptor | undefined;
    Parameters
    args
    DecoratorArguments | IArguments

    Returns
    DecoratorDescriptor | undefined

    isAccessor(value)

    Declaration
    export declare function isAccessor(value: DecoratorDescriptor): value is AccessorMemberDescriptor;
    Parameters
    value
    DecoratorDescriptor

    Returns
    value is AccessorMemberDescriptor

    isClass(value)

    Declaration
    export declare function isClass(value: DecoratorDescriptor): value is ClassDescriptor;
    Parameters
    value
    DecoratorDescriptor

    Returns
    value is ClassDescriptor

    isClassDecoratorArguments(args)

    Declaration
    export declare function isClassDecoratorArguments(args: DecoratorArguments | IArguments | unknown[]): args is ClassDecoratorArguments;
    Parameters
    args
    DecoratorArguments | IArguments | unknown[]

    Returns
    args is ClassDecoratorArguments

    isDecoratorArguments(args)

    Declaration
    export declare function isDecoratorArguments(args: DecoratorArguments | IArguments | unknown[]): args is DecoratorArguments;
    Parameters
    args
    DecoratorArguments | IArguments | unknown[]

    Returns
    args is DecoratorArguments

    isField(value)

    Declaration
    export declare function isField(value: DecoratorDescriptor): value is FieldMemberDescriptor;
    Parameters
    value
    DecoratorDescriptor

    Returns
    value is FieldMemberDescriptor

    isMember(value)

    Declaration
    export declare function isMember(value: DecoratorDescriptor): value is MemberDescriptor;
    Parameters
    value
    DecoratorDescriptor

    Returns
    value is MemberDescriptor

    isMemberDecoratorArguments(args)

    Declaration
    export declare function isMemberDecoratorArguments(args: DecoratorArguments | IArguments | unknown[]): args is MemberDecoratorArguments;
    Parameters
    args
    DecoratorArguments | IArguments | unknown[]

    Returns
    args is MemberDecoratorArguments

    isMethod(value)

    Declaration
    export declare function isMethod(value: DecoratorDescriptor): value is MethodMemberDescriptor;
    Parameters
    value
    DecoratorDescriptor

    Returns
    value is MethodMemberDescriptor

    isNonStatic(value)

    Declaration
    export declare function isNonStatic(value: MemberDescriptor | ParameterDescriptor): boolean;
    Parameters
    value
    MemberDescriptor | ParameterDescriptor

    Returns
    boolean

    isParameter(value)

    Declaration
    export declare function isParameter(value: DecoratorDescriptor): value is ParameterDescriptor;
    Parameters
    value
    DecoratorDescriptor

    Returns
    value is ParameterDescriptor

    isParameterDecoratorArguments(args)

    Declaration
    export declare function isParameterDecoratorArguments(args: DecoratorArguments | IArguments | unknown[]): args is ParameterDecoratorArguments;
    Parameters
    args
    DecoratorArguments | IArguments | unknown[]

    Returns
    args is ParameterDecoratorArguments

    isStatic(value)

    Declaration
    export declare function isStatic(value: MemberDescriptor | ParameterDescriptor): boolean;
    Parameters
    value
    MemberDescriptor | ParameterDescriptor

    Returns
    boolean

    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>;
    • Improve this Doc
    Generated by DocFX