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