Function set

  • Sets the property of target, equivalent to target[propertyKey] = value when receiver === target.

    Type Parameters

    Parameters

    • target: T

      Object that contains the property on itself or in its prototype chain.

    • propertyKey: P

      Name of the property.

    • value: P extends keyof T ? T[P<P>] : any
    • Optionalreceiver: any

      The reference to use as the this value in the setter function, if target[propertyKey] is an accessor property.

    Returns boolean

  • Sets the property of target, equivalent to target[propertyKey] = value when receiver === target.

    Parameters

    • target: object

      Object that contains the property on itself or in its prototype chain.

    • propertyKey: PropertyKey

      Name of the property.

    • value: any
    • Optionalreceiver: any

      The reference to use as the this value in the setter function, if target[propertyKey] is an accessor property.

    Returns boolean