@@ -10,8 +10,34 @@ interface ProxyHandler<T extends object> {
10
10
deleteProperty ? ( target : T , p : string | symbol ) : boolean ;
11
11
defineProperty ? ( target : T , p : string | symbol , attributes : PropertyDescriptor ) : boolean ;
12
12
ownKeys ? ( target : T ) : ArrayLike < string | symbol > ;
13
- apply ? ( target : T & ( ( ...args : any [ ] ) => any ) , thisArg : any , argArray : any [ ] ) : any ;
14
- construct ? ( target : T & ( new ( ...args : any [ ] ) => object ) , argArray : any [ ] , newTarget ?: any ) : object ;
13
+
14
+ /**
15
+ * Called only when target is a callable function.
16
+ *
17
+ * The default implementation is equivalent to `Reflect.apply(target, thisArg, argArray)`
18
+ *
19
+ * @param target The function wrapped by this proxy
20
+ * @param thisArg The `this` parameter type
21
+ * @param argArray The arguments passed to the function
22
+ */
23
+ apply ?(
24
+ target : T extends ( ...args : any [ ] ) => any ? T : never ,
25
+ thisArg : T extends ( this : infer U , ...args : any [ ] ) => any ? U : any ,
26
+ argArray : T extends ( ...args : infer A ) => any ? A : any [ ]
27
+ ) : any ;
28
+
29
+ /**
30
+ * Called only when `target` is a newable function.
31
+ *
32
+ * @param target The function wrapped by this proxy
33
+ * @param argArray The arguments passed to the constructor
34
+ * @param newTarget The value of `new.target`
35
+ */
36
+ construct ?(
37
+ target : T extends new ( ...args : any [ ] ) => any ? T : never ,
38
+ argArray : T extends new ( ...args : infer A ) => any ? A : any [ ] ,
39
+ newTarget ?: any
40
+ ) : object ;
15
41
}
16
42
17
43
interface ProxyConstructor {
0 commit comments