• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1declare namespace Reflect {
2    /**
3     * Calls the function with the specified object as the this value
4     * and the elements of specified array as the arguments.
5     * @param target The function to call.
6     * @param thisArgument The object to be used as the this object.
7     * @param argumentsList An array of argument values to be passed to the function.
8     */
9    function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
10
11    /**
12     * Constructs the target with the elements of specified array as the arguments
13     * and the specified constructor as the `new.target` value.
14     * @param target The constructor to invoke.
15     * @param argumentsList An array of argument values to be passed to the constructor.
16     * @param newTarget The constructor to be used as the `new.target` object.
17     */
18    function construct(target: Function, argumentsList: ArrayLike<any>, newTarget?: Function): any;
19
20    /**
21     * Adds a property to an object, or modifies attributes of an existing property.
22     * @param target Object on which to add or modify the property. This can be a native JavaScript object
23     *        (that is, a user-defined object or a built in object) or a DOM object.
24     * @param propertyKey The property name.
25     * @param attributes Descriptor for the property. It can be for a data property or an accessor property.
26     */
27    function defineProperty(target: object, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
28
29    /**
30     * Removes a property from an object, equivalent to `delete target[propertyKey]`,
31     * except it won't throw if `target[propertyKey]` is non-configurable.
32     * @param target Object from which to remove the own property.
33     * @param propertyKey The property name.
34     */
35    function deleteProperty(target: object, propertyKey: PropertyKey): boolean;
36
37    /**
38     * Gets the property of target, equivalent to `target[propertyKey]` when `receiver === target`.
39     * @param target Object that contains the property on itself or in its prototype chain.
40     * @param propertyKey The property name.
41     * @param receiver The reference to use as the `this` value in the getter function,
42     *        if `target[propertyKey]` is an accessor property.
43     */
44    function get(target: object, propertyKey: PropertyKey, receiver?: any): any;
45
46    /**
47     * Gets the own property descriptor of the specified object.
48     * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype.
49     * @param target Object that contains the property.
50     * @param propertyKey The property name.
51     */
52    function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor | undefined;
53
54    /**
55     * Returns the prototype of an object.
56     * @param target The object that references the prototype.
57     */
58    function getPrototypeOf(target: object): object | null;
59
60    /**
61     * Equivalent to `propertyKey in target`.
62     * @param target Object that contains the property on itself or in its prototype chain.
63     * @param propertyKey Name of the property.
64     */
65    function has(target: object, propertyKey: PropertyKey): boolean;
66
67    /**
68     * Returns a value that indicates whether new properties can be added to an object.
69     * @param target Object to test.
70     */
71    function isExtensible(target: object): boolean;
72
73    /**
74     * Returns the string and symbol keys of the own properties of an object. The own properties of an object
75     * are those that are defined directly on that object, and are not inherited from the object's prototype.
76     * @param target Object that contains the own properties.
77     */
78    function ownKeys(target: object): (string | symbol)[];
79
80    /**
81     * Prevents the addition of new properties to an object.
82     * @param target Object to make non-extensible.
83     * @return Whether the object has been made non-extensible.
84     */
85    function preventExtensions(target: object): boolean;
86
87    /**
88     * Sets the property of target, equivalent to `target[propertyKey] = value` when `receiver === target`.
89     * @param target Object that contains the property on itself or in its prototype chain.
90     * @param propertyKey Name of the property.
91     * @param receiver The reference to use as the `this` value in the setter function,
92     *        if `target[propertyKey]` is an accessor property.
93     */
94    function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
95
96    /**
97     * Sets the prototype of a specified object o to object proto or null.
98     * @param target The object to change its prototype.
99     * @param proto The value of the new prototype or null.
100     * @return Whether setting the prototype was successful.
101     */
102    function setPrototypeOf(target: object, proto: object | null): boolean;
103}
104