Skip to content

Commit 79e0e33

Browse files
committed
fix: fix docs gap
1 parent a8bdade commit 79e0e33

File tree

6 files changed

+53
-152
lines changed

6 files changed

+53
-152
lines changed

lib/lib.es2015.collection.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
interface Map<K, V> {
2+
/**
3+
* Executes a provided function once per each key/value pair in the Map, in insertion order.
4+
*/
25
forEach<This = undefined>(
36
callbackfn: (this: This, value: V, key: K, map: this) => void,
47
thisArg?: This
@@ -25,6 +28,9 @@ interface ReadonlyMap<K, V> {
2528
}
2629

2730
interface Set<T> {
31+
/**
32+
* Executes a provided function once per each value in the Set object, in insertion order.
33+
*/
2834
forEach<This = undefined>(
2935
callbackfn: (this: This, value: T, value2: T, set: this) => void,
3036
thisArg?: This

lib/lib.es2015.iterable.d.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ interface IterableIterator<T> extends Iterator<T, undefined, void> {
1111

1212
interface ArrayConstructor {
1313
/**
14-
* Creates an array from an array-like or iterable object.
15-
* @param source An array-like or iterable object to convert to an array.
14+
* Creates an array from an iterable object.
15+
* @param iterable An iterable object to convert to an array.
1616
*/
17-
from<T>(source: Iterable<T> | ArrayLike<T>): T[];
17+
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
1818

1919
/**
20-
* Creates an array from an array-like or iterable object.
21-
* @param source An array-like or iterable object to convert to an array.
20+
* Creates an array from an iterable object.
21+
* @param iterable An iterable object to convert to an array.
2222
* @param mapfn A mapping function to call on every element of the array.
2323
* @param thisArg Value of 'this' used to invoke the mapfn.
2424
*/
2525
from<T, U, This = undefined>(
26-
source: Iterable<T> | ArrayLike<T>,
26+
iterable: Iterable<T> | ArrayLike<T>,
2727
mapfn: (this: This, v: T, k: number) => U,
2828
thisArg?: This
2929
): U[];
@@ -58,18 +58,18 @@ interface MapConstructor {
5858

5959
interface TypedNumberArrayConstructor {
6060
/**
61-
* Creates an array from an array-like or iterable object.
62-
* @param source An array-like or iterable object to convert to an array.
61+
* Creates an array from an iterable object.
62+
* @param iterable An iterable object to convert to an array.
6363
*/
64-
from(source: Iterable<number> | ArrayLike<number>): TypedNumberArray;
64+
from(iterable: Iterable<number> | ArrayLike<number>): TypedNumberArray;
6565
/**
66-
* Creates an array from an array-like or iterable object.
67-
* @param source An array-like or iterable object to convert to an array.
66+
* Creates an array from an iterable object.
67+
* @param iterable An iterable object to convert to an array.
6868
* @param mapfn A mapping function to call on every element of the array.
6969
* @param thisArg Value of 'this' used to invoke the mapfn.
7070
*/
7171
from<T, This = undefined>(
72-
source: Iterable<T> | ArrayLike<T>,
72+
iterable: Iterable<T> | ArrayLike<T>,
7373
mapfn: (this: This, v: T, k: number) => number,
7474
thisArg?: This
7575
): TypedNumberArray;

lib/lib.es2015.proxy.d.ts

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
interface ProxyHandler<T extends object> {
2+
/**
3+
* A trap method for a function call.
4+
* @param target The original callable object which is being proxied.
5+
*/
26
apply?(target: T, thisArg: unknown, argArray: unknown[]): any;
7+
/**
8+
* A trap for the `new` operator.
9+
* @param target The original object which is being proxied.
10+
* @param newTarget The constructor that was originally called.
11+
*/
312
construct?(target: T, argArray: unknown[], newTarget: unknown): object;
4-
defineProperty?(
5-
target: T,
6-
p: PropertyKey,
7-
attributes: PropertyDescriptor
8-
): boolean;
9-
deleteProperty?(target: T, p: PropertyKey): boolean;
10-
get?(target: T, p: PropertyKey, receiver: unknown): any;
11-
getOwnPropertyDescriptor?(
12-
target: T,
13-
p: PropertyKey
14-
): PropertyDescriptor | undefined;
15-
getPrototypeOf?(target: T): object | null;
16-
has?(target: T, p: PropertyKey): boolean;
17-
ownKeys?(target: T): PropertyKey[];
18-
set?(target: T, p: PropertyKey, value: unknown, receiver: unknown): boolean;
19-
setPrototypeOf?(target: T, v: unknown): boolean;
13+
/**
14+
* A trap for getting a property value.
15+
* @param target The original object which is being proxied.
16+
* @param p The name or `Symbol` of the property to get.
17+
* @param receiver The proxy or an object that inherits from the proxy.
18+
*/
19+
get?(target: T, p: string | symbol, receiver: unknown): any;
20+
/**
21+
* A trap for setting a property value.
22+
* @param target The original object which is being proxied.
23+
* @param p The name or `Symbol` of the property to set.
24+
* @param receiver The object to which the assignment was originally directed.
25+
* @returns A `Boolean` indicating whether or not the property was set.
26+
*/
27+
set?(target: T, p: string | symbol, value: unknown, receiver: unknown): boolean;
2028
}

lib/lib.es2015.reflect.d.ts

Lines changed: 4 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,14 @@
11
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-
492
/**
503
* Gets the property of target, equivalent to `target[propertyKey]` when `receiver === target`.
514
* @param target Object that contains the property on itself or in its prototype chain.
525
* @param propertyKey The property name.
536
* @param receiver The reference to use as the `this` value in the getter function,
547
* if `target[propertyKey]` is an accessor property.
558
*/
56-
function get<T, K extends PropertyKey>(
9+
function get<T, P extends PropertyKey>(
5710
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;
12714
}

lib/lib.es2015.symbol.wellknown.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ interface RegExp {
3535

3636
interface String {
3737
/**
38-
* Replaces first match with string or all matches with RegExp.
39-
* @param searchValue A object can search for and replace matches within a string.
40-
* @param replaceValue A string containing the text to replace for match.
38+
* Passes a string and {@linkcode replaceValue} to the `[Symbol.replace]` method on {@linkcode searchValue}. This method is expected to implement its own replacement algorithm.
39+
* @param searchValue An object that supports searching for and replacing matches within a string.
40+
* @param replaceValue The replacement text.
4141
*/
4242
replace(
4343
searchValue: {

lib/lib.es5.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -773,17 +773,17 @@ interface TypedNumberArray {
773773
interface TypedNumberArrayConstructor {
774774
/**
775775
* Creates an array from an array-like or iterable object.
776-
* @param source An array-like or iterable object to convert to an array.
776+
* @param arrayLike An array-like or iterable object to convert to an array.
777777
*/
778-
from(source: ArrayLike<number>): TypedNumberArray;
778+
from(arrayLike: ArrayLike<number>): TypedNumberArray;
779779
/**
780780
* Creates an array from an array-like or iterable object.
781-
* @param source An array-like or iterable object to convert to an array.
781+
* @param arrayLike An array-like or iterable object to convert to an array.
782782
* @param mapfn A mapping function to call on every element of the array.
783783
* @param thisArg Value of 'this' used to invoke the mapfn.
784784
*/
785785
from<T, This = undefined>(
786-
source: ArrayLike<T>,
786+
arrayLike: ArrayLike<T>,
787787
mapfn: (this: This, v: T, k: number) => number,
788788
thisArg?: This
789789
): TypedNumberArray;

0 commit comments

Comments
 (0)