UNPKG

5.88 kBTypeScriptView Raw
1/*! *****************************************************************************
2Copyright (c) Microsoft Corporation. All rights reserved.
3Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4this file except in compliance with the License. You may obtain a copy of the
5License at http://www.apache.org/licenses/LICENSE-2.0
6
7THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10MERCHANTABLITY OR NON-INFRINGEMENT.
11
12See the Apache Version 2.0 License for specific language governing permissions
13and limitations under the License.
14***************************************************************************** */
15
16
17
18/// <reference no-default-lib="true"/>
19
20
21declare namespace Reflect {
22 /**
23 * Calls the function with the specified object as the this value
24 * and the elements of specified array as the arguments.
25 * @param target The function to call.
26 * @param thisArgument The object to be used as the this object.
27 * @param argumentsList An array of argument values to be passed to the function.
28 */
29 function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
30
31 /**
32 * Constructs the target with the elements of specified array as the arguments
33 * and the specified constructor as the `new.target` value.
34 * @param target The constructor to invoke.
35 * @param argumentsList An array of argument values to be passed to the constructor.
36 * @param newTarget The constructor to be used as the `new.target` object.
37 */
38 function construct(target: Function, argumentsList: ArrayLike<any>, newTarget?: Function): any;
39
40 /**
41 * Adds a property to an object, or modifies attributes of an existing property.
42 * @param target Object on which to add or modify the property. This can be a native JavaScript object
43 * (that is, a user-defined object or a built in object) or a DOM object.
44 * @param propertyKey The property name.
45 * @param attributes Descriptor for the property. It can be for a data property or an accessor property.
46 */
47 function defineProperty(target: object, propertyKey: PropertyKey, attributes: PropertyDescriptor & ThisType<any>): boolean;
48
49 /**
50 * Removes a property from an object, equivalent to `delete target[propertyKey]`,
51 * except it won't throw if `target[propertyKey]` is non-configurable.
52 * @param target Object from which to remove the own property.
53 * @param propertyKey The property name.
54 */
55 function deleteProperty(target: object, propertyKey: PropertyKey): boolean;
56
57 /**
58 * Gets the property of target, equivalent to `target[propertyKey]` when `receiver === target`.
59 * @param target Object that contains the property on itself or in its prototype chain.
60 * @param propertyKey The property name.
61 * @param receiver The reference to use as the `this` value in the getter function,
62 * if `target[propertyKey]` is an accessor property.
63 */
64 function get(target: object, propertyKey: PropertyKey, receiver?: any): any;
65
66 /**
67 * Gets the own property descriptor of the specified object.
68 * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype.
69 * @param target Object that contains the property.
70 * @param propertyKey The property name.
71 */
72 function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor | undefined;
73
74 /**
75 * Returns the prototype of an object.
76 * @param target The object that references the prototype.
77 */
78 function getPrototypeOf(target: object): object | null;
79
80 /**
81 * Equivalent to `propertyKey in target`.
82 * @param target Object that contains the property on itself or in its prototype chain.
83 * @param propertyKey Name of the property.
84 */
85 function has(target: object, propertyKey: PropertyKey): boolean;
86
87 /**
88 * Returns a value that indicates whether new properties can be added to an object.
89 * @param target Object to test.
90 */
91 function isExtensible(target: object): boolean;
92
93 /**
94 * Returns the string and symbol keys of the own properties of an object. The own properties of an object
95 * are those that are defined directly on that object, and are not inherited from the object's prototype.
96 * @param target Object that contains the own properties.
97 */
98 function ownKeys(target: object): (string | symbol)[];
99
100 /**
101 * Prevents the addition of new properties to an object.
102 * @param target Object to make non-extensible.
103 * @return Whether the object has been made non-extensible.
104 */
105 function preventExtensions(target: object): boolean;
106
107 /**
108 * Sets the property of target, equivalent to `target[propertyKey] = value` when `receiver === target`.
109 * @param target Object that contains the property on itself or in its prototype chain.
110 * @param propertyKey Name of the property.
111 * @param receiver The reference to use as the `this` value in the setter function,
112 * if `target[propertyKey]` is an accessor property.
113 */
114 function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
115
116 /**
117 * Sets the prototype of a specified object o to object proto or null.
118 * @param target The object to change its prototype.
119 * @param proto The value of the new prototype or null.
120 * @return Whether setting the prototype was successful.
121 */
122 function setPrototypeOf(target: object, proto: object | null): boolean;
123}