Interface ClassGetterDecoratorContext<This, Value>

    Context provided to a class getter decorator.

    interface ClassGetterDecoratorContext<This, Value> {
        access: {
            get(object: This): Value;
            has(object: This): boolean;
        };
        kind: "getter";
        metadata: DecoratorMetadataObject;
        name: string | symbol;
        private: boolean;
        static: boolean;
        addInitializer(initializer: ((this: This) => void)): void;
    }

    Type Parameters

    • This = unknown

      The type on which the class element will be defined. For a static class element, this will be the type of the constructor. For a non-static class element, this will be the type of the instance.

    • Value = unknown

      The property type of the decorated class getter.

    Properties

    access: {
        get(object: This): Value;
        has(object: This): boolean;
    }

    An object that can be used to access the current value of the class element at runtime.

    Type declaration

    • get:function
      • Invokes the getter on the provided object.

        Parameters

        Returns Value

        let value = context.access.get(instance);
        
    • has:function
      • Determines whether an object has a property with the same name as the decorated element.

        Parameters

        Returns boolean

    kind: "getter"

    The kind of class element that was decorated.

    name: string | symbol

    The name of the decorated class element.

    private: boolean

    A value indicating whether the class element has a private name.

    static: boolean

    A value indicating whether the class element is a static (true) or instance (false) element.

    Methods

    • Adds a callback to be invoked either before static initializers are run (when decorating a static element), or before instance initializers are run (when decorating a non-static element).

      Parameters

      • initializer: ((this: This) => void)
          • (this): void
          • Parameters

            Returns void

      Returns void