Skip to content

Commit 324200f

Browse files
committed
lib: document remaining ProxyHandler trap parameters
Several ProxyHandler traps document `target` and then stop, leaving the rest of their parameters with no description in hover and signature help: `apply` is missing `thisArg` and `argArray`, `construct` skips `argArray`, `defineProperty` is missing `property` and `attributes`, and `set` skips `newValue`. `setPrototypeOf` has the same symptom for a different reason: it documents `@param newPrototype` while the parameter is named `v`, so the tag matches nothing and the description is dropped. Rename the parameter to `newPrototype` to match both the existing tag and the sibling `set` trap, which already spells its value parameter `newValue` rather than the spec's `V`.
1 parent b465fdb commit 324200f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/lib/es2015.proxy.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@ interface ProxyHandler<T extends object> {
22
/**
33
* A trap method for a function call.
44
* @param target The original callable object which is being proxied.
5+
* @param thisArg The `this` argument for the call.
6+
* @param argArray The list of arguments for the call.
57
*/
68
apply?(target: T, thisArg: any, argArray: any[]): any;
79

810
/**
911
* A trap for the `new` operator.
1012
* @param target The original object which is being proxied.
13+
* @param argArray The list of arguments for the constructor.
1114
* @param newTarget The constructor that was originally called.
1215
*/
1316
construct?(target: T, argArray: any[], newTarget: Function): object;
1417

1518
/**
1619
* A trap for `Object.defineProperty()`.
1720
* @param target The original object which is being proxied.
21+
* @param property The name or `Symbol` of the property to define.
22+
* @param attributes The descriptor for the property being defined or modified.
1823
* @returns A `Boolean` indicating whether or not the property has been defined.
1924
*/
2025
defineProperty?(target: T, property: string | symbol, attributes: PropertyDescriptor): boolean;
@@ -77,6 +82,7 @@ interface ProxyHandler<T extends object> {
7782
* A trap for setting a property value.
7883
* @param target The original object which is being proxied.
7984
* @param p The name or `Symbol` of the property to set.
85+
* @param newValue The new value of the property to set.
8086
* @param receiver The object to which the assignment was originally directed.
8187
* @returns A `Boolean` indicating whether or not the property was set.
8288
*/
@@ -87,7 +93,7 @@ interface ProxyHandler<T extends object> {
8793
* @param target The original object which is being proxied.
8894
* @param newPrototype The object's new prototype or `null`.
8995
*/
90-
setPrototypeOf?(target: T, v: object | null): boolean;
96+
setPrototypeOf?(target: T, newPrototype: object | null): boolean;
9197
}
9298

9399
interface ProxyConstructor {

0 commit comments

Comments
 (0)