Skip to content

Commit 689670f

Browse files
committed
JSDocs for types
1 parent 7e781f8 commit 689670f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1510
-21
lines changed

packages/core-js-types/src/56/proposals/accessible-object-hasownproperty.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,10 @@
55
// https://github.com/microsoft/TypeScript/blob/069de743dbd17b47cc2fc58e1d16da5410911284/src/lib/es2022.object.d.ts
66
// License: https://github.com/microsoft/TypeScript/blob/v5.9.3/LICENSE.txt
77
interface ObjectConstructor {
8+
/**
9+
* Determines whether an object has a property with the specified name.
10+
* @param o An object.
11+
* @param v A property name.
12+
*/
813
hasOwn(o: object, v: PropertyKey): boolean;
914
}

packages/core-js-types/src/56/proposals/array-buffer-base64.d.ts

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,51 @@ type processMetadata = {
2525
}
2626

2727
interface Uint8ArrayConstructor {
28-
fromBase64(str: string, opts?: fromBase64Options): Uint8Array;
28+
/**
29+
* Creates a new `Uint8Array` from a base64-encoded string.
30+
* @param string The base64-encoded string.
31+
* @param options If provided, specifies the alphabet and handling of the last chunk.
32+
* @returns A new `Uint8Array` instance.
33+
* @throws {SyntaxError} If the input string contains characters outside the specified alphabet, or if the last
34+
* chunk is inconsistent with the `lastChunkHandling` option.
35+
*/
36+
fromBase64(string: string, options?: fromBase64Options): Uint8Array;
2937

38+
/**
39+
* Creates a new `Uint8Array` from a base16-encoded string.
40+
* @returns A new `Uint8Array` instance.
41+
*/
3042
fromHex(str: string): Uint8Array;
3143
}
3244

3345
interface Uint8Array {
34-
setFromBase64(str: string, opts?: fromBase64Options): processMetadata;
46+
/**
47+
* Sets the `Uint8Array` from a base64-encoded string.
48+
* @param string The base64-encoded string.
49+
* @param options If provided, specifies the alphabet and handling of the last chunk.
50+
* @returns An object containing the number of bytes read and written.
51+
* @throws {SyntaxError} If the input string contains characters outside the specified alphabet, or if the last
52+
* chunk is inconsistent with the `lastChunkHandling` option.
53+
*/
54+
setFromBase64(string: string, options?: fromBase64Options): processMetadata;
3555

36-
setFromHex(str: string): processMetadata;
56+
/**
57+
* Sets the `Uint8Array` from a base16-encoded string.
58+
* @param string The base16-encoded string.
59+
* @returns An object containing the number of bytes read and written.
60+
*/
61+
setFromHex(string: string): processMetadata;
3762

38-
toBase64(opts?: toBase64Options): string;
63+
/**
64+
* Converts the `Uint8Array` to a base64-encoded string.
65+
* @param options If provided, sets the alphabet and padding behavior used.
66+
* @returns A base64-encoded string.
67+
*/
68+
toBase64(options?: toBase64Options): string;
3969

70+
/**
71+
* Converts the `Uint8Array` to a base16-encoded string.
72+
* @returns A base16-encoded string.
73+
*/
4074
toHex(): string;
4175
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
11
// proposal stage: 4
22
// https://github.com/tc39/proposal-arraybuffer-transfer
33

4+
// For ensuring compatibility with TypeScript standard types, this code is based on:
5+
// https://github.com/microsoft/TypeScript/blob/4a957b74ea4d716356181644d23f6ad5f10824d6/src/lib/es2024.arraybuffer.d.ts
6+
// License: https://github.com/microsoft/TypeScript/blob/v5.9.3/LICENSE.txt
7+
48
interface ArrayBuffer {
59
// todo hack for modern ts
610
// get detached(): boolean;
711

12+
/**
13+
* Creates a new `ArrayBuffer` with the same byte content as this buffer, then detaches this buffer.
14+
* @param newByteLength If provided, specifies the `byteLength` of the new `ArrayBuffer`
15+
* @throws {RangeError} If this `ArrayBuffer` is resizable and newByteLength is greater than the `maxByteLength` of this `ArrayBuffer`
16+
* @throws {TypeError} If this `ArrayBuffer` is already detached, or if it can only be detached by designated operations
17+
* @returns A new `ArrayBuffer` object
18+
*/
819
transfer(newByteLength?: number): ArrayBuffer;
920

21+
/**
22+
* Creates a new non-resizable `ArrayBuffer` with the same byte content as this buffer, then detaches this buffer.
23+
* @param newByteLength If provided, specifies the `byteLength` of the new `ArrayBuffer`
24+
* @throws {TypeError} If this `ArrayBuffer` is already detached, or if it can only be detached by designated operations
25+
* @returns A new `ArrayBuffer` object
26+
*/
1027
transferToFixedLength(newByteLength?: number): ArrayBuffer;
1128
}

packages/core-js-types/src/56/proposals/array-filtering.d.ts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,101 @@
22
// https://github.com/tc39/proposal-array-filtering
33

44
interface Array<T> {
5+
/**
6+
* Removes the items that return true
7+
* @param callbackFn A function that accepts up to three arguments. The filterReject method calls the
8+
* callbackFn function one time for each element in the array.
9+
* @param thisArg If provided, it will be used as this value for each invocation of
10+
* predicate. If it is not provided, undefined is used instead.
11+
*/
512
filterReject(callbackFn: (value: T, index: number, target: T[]) => boolean, thisArg?: any): T[];
613
}
714

815
interface Int8Array {
16+
/**
17+
* Removes the items that return true
18+
* @param callbackFn A function that accepts up to three arguments. The filterReject method calls the
19+
* callbackFn function one time for each element in the array.
20+
* @param thisArg If provided, it will be used as this value for each invocation of
21+
* predicate. If it is not provided, undefined is used instead.
22+
*/
923
filterReject(callbackFn: (value: number, index: number, target: Int8Array) => boolean, thisArg?: any): Int8Array;
1024
}
1125

1226
interface Uint8Array {
27+
/**
28+
* Removes the items that return true
29+
* @param callbackFn A function that accepts up to three arguments. The filterReject method calls the
30+
* callbackFn function one time for each element in the array.
31+
* @param thisArg If provided, it will be used as this value for each invocation of
32+
* predicate. If it is not provided, undefined is used instead.
33+
*/
1334
filterReject(callbackFn: (value: number, index: number, target: Uint8Array) => boolean, thisArg?: any): Uint8Array;
1435
}
1536

1637
interface Uint8ClampedArray {
38+
/**
39+
* Removes the items that return true
40+
* @param callbackFn A function that accepts up to three arguments. The filterReject method calls the
41+
* callbackFn function one time for each element in the array.
42+
* @param thisArg If provided, it will be used as this value for each invocation of
43+
* predicate. If it is not provided, undefined is used instead.
44+
*/
1745
filterReject(callbackFn: (value: number, index: number, target: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray;
1846
}
1947

2048
interface Int16Array {
49+
/**
50+
* Removes the items that return true
51+
* @param callbackFn A function that accepts up to three arguments. The filterReject method calls the
52+
* callbackFn function one time for each element in the array.
53+
* @param thisArg If provided, it will be used as this value for each invocation of
54+
* predicate. If it is not provided, undefined is used instead.
55+
*/
2156
filterReject(callbackFn: (value: number, index: number, target: Int16Array) => boolean, thisArg?: any): Int16Array;
2257
}
2358

2459
interface Uint16Array {
60+
/**
61+
* Removes the items that return true
62+
* @param callbackFn A function that accepts up to three arguments. The filterReject method calls the
63+
* callbackFn function one time for each element in the array.
64+
* @param thisArg If provided, it will be used as this value for each invocation of
65+
* predicate. If it is not provided, undefined is used instead.
66+
*/
2567
filterReject(callbackFn: (value: number, index: number, target: Uint16Array) => boolean, thisArg?: any): Uint16Array;
2668
}
2769

2870
interface Int32Array {
71+
/**
72+
* Removes the items that return true
73+
* @param callbackFn A function that accepts up to three arguments. The filterReject method calls the
74+
* callbackFn function one time for each element in the array.
75+
* @param thisArg If provided, it will be used as this value for each invocation of
76+
* predicate. If it is not provided, undefined is used instead.
77+
*/
2978
filterReject(callbackFn: (value: number, index: number, target: Int32Array) => boolean, thisArg?: any): Int32Array;
3079
}
3180

3281
interface Uint32Array {
82+
/**
83+
* Removes the items that return true
84+
* @param callbackFn A function that accepts up to three arguments. The filterReject method calls the
85+
* callbackFn function one time for each element in the array.
86+
* @param thisArg If provided, it will be used as this value for each invocation of
87+
* predicate. If it is not provided, undefined is used instead.
88+
*/
3389
filterReject(callbackFn: (value: number, index: number, target: Uint32Array) => boolean, thisArg?: any): Uint32Array;
3490
}
3591

3692
interface Float32Array {
93+
/**
94+
* Removes the items that return true
95+
* @param callbackFn A function that accepts up to three arguments. The filterReject method calls the
96+
* callbackFn function one time for each element in the array.
97+
* @param thisArg If provided, it will be used as this value for each invocation of
98+
* predicate. If it is not provided, undefined is used instead.
99+
*/
37100
filterReject(callbackFn: (value: number, index: number, target: Float32Array) => boolean, thisArg?: any): Float32Array;
38101
}
39102

@@ -42,9 +105,23 @@ interface Float64Array {
42105
}
43106

44107
interface BigInt64Array {
108+
/**
109+
* Removes the items that return true
110+
* @param callbackFn A function that accepts up to three arguments. The filterReject method calls the
111+
* callbackFn function one time for each element in the array.
112+
* @param thisArg If provided, it will be used as this value for each invocation of
113+
* predicate. If it is not provided, undefined is used instead.
114+
*/
45115
filterReject(callbackFn: (value: bigint, index: number, target: BigInt64Array) => boolean, thisArg?: any): BigInt64Array;
46116
}
47117

48118
interface BigUint64Array {
119+
/**
120+
* Removes the items that return true
121+
* @param callbackFn A function that accepts up to three arguments. The filterReject method calls the
122+
* callbackFn function one time for each element in the array.
123+
* @param thisArg If provided, it will be used as this value for each invocation of
124+
* predicate. If it is not provided, undefined is used instead.
125+
*/
49126
filterReject(callbackFn: (value: bigint, index: number, target: BigUint64Array) => boolean, thisArg?: any): BigUint64Array;
50127
}

0 commit comments

Comments
 (0)