Interface ProxyHandler<T>

    interface ProxyHandler<T> {
        apply?(target: T, thisArg: any, argArray: any[]): any;
        construct?(target: T, argArray: any[], newTarget: Function): object;
        defineProperty?(target: T, property: string | symbol, attributes: PropertyDescriptor): boolean;
        deleteProperty?(target: T, p: string | symbol): boolean;
        get?(target: T, p: string | symbol, receiver: any): any;
        getOwnPropertyDescriptor?(target: T, p: string | symbol): PropertyDescriptor;
        getPrototypeOf?(target: T): object;
        has?(target: T, p: string | symbol): boolean;
        isExtensible?(target: T): boolean;
        ownKeys?(target: T): ArrayLike<string | symbol>;
        preventExtensions?(target: T): boolean;
        set?(target: T, p: string | symbol, newValue: any, receiver: any): boolean;
        setPrototypeOf?(target: T, v: object): boolean;
    }

    Type Parameters

    • T extends object

    Methods

    • A trap method for a function call.

      Parameters

      • target: T

        The original callable object which is being proxied.

      • thisArg: any
      • argArray: any[]

      Returns any

    • A trap for the new operator.

      Parameters

      • target: T

        The original object which is being proxied.

      • argArray: any[]
      • newTarget: Function

        The constructor that was originally called.

      Returns object

    • A trap for Object.defineProperty().

      Parameters

      • target: T

        The original object which is being proxied.

      • property: string | symbol
      • attributes: PropertyDescriptor

      Returns boolean

      A Boolean indicating whether or not the property has been defined.

    • A trap for the delete operator.

      Parameters

      • target: T

        The original object which is being proxied.

      • p: string | symbol

        The name or Symbol of the property to delete.

      Returns boolean

      A Boolean indicating whether or not the property was deleted.

    • A trap for getting a property value.

      Parameters

      • target: T

        The original object which is being proxied.

      • p: string | symbol

        The name or Symbol of the property to get.

      • receiver: any

        The proxy or an object that inherits from the proxy.

      Returns any

    • A trap for Object.getOwnPropertyDescriptor().

      Parameters

      • target: T

        The original object which is being proxied.

      • p: string | symbol

        The name of the property whose description should be retrieved.

      Returns PropertyDescriptor

    • A trap for the [[GetPrototypeOf]] internal method.

      Parameters

      • target: T

        The original object which is being proxied.

      Returns object

    • A trap for the in operator.

      Parameters

      • target: T

        The original object which is being proxied.

      • p: string | symbol

        The name or Symbol of the property to check for existence.

      Returns boolean

    • A trap for Object.isExtensible().

      Parameters

      • target: T

        The original object which is being proxied.

      Returns boolean

    • A trap for Reflect.ownKeys().

      Parameters

      • target: T

        The original object which is being proxied.

      Returns ArrayLike<string | symbol>

    • A trap for Object.preventExtensions().

      Parameters

      • target: T

        The original object which is being proxied.

      Returns boolean

    • A trap for setting a property value.

      Parameters

      • target: T

        The original object which is being proxied.

      • p: string | symbol

        The name or Symbol of the property to set.

      • newValue: any
      • receiver: any

        The object to which the assignment was originally directed.

      Returns boolean

      A Boolean indicating whether or not the property was set.

    • A trap for Object.setPrototypeOf().

      Parameters

      • target: T

        The original object which is being proxied.

      • v: object

      Returns boolean