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