Skip to content

Commit 7901a39

Browse files
authored
Fix JSDoc for Array#sort, TypedArray#sort and Array#toSorted methods (#60983)
1 parent 700ee07 commit 7901a39

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

src/lib/es2023.array.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ interface Array<T> {
3131
* Returns a copy of an array with its elements sorted.
3232
* @param compareFn Function used to determine the order of the elements. It is expected to return
3333
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
34-
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
34+
* value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.
3535
* ```ts
3636
* [11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]
3737
* ```
@@ -109,7 +109,7 @@ interface ReadonlyArray<T> {
109109
* Copies and sorts the array.
110110
* @param compareFn Function used to determine the order of the elements. It is expected to return
111111
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
112-
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
112+
* value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.
113113
* ```ts
114114
* [11, 2, 22, 1].toSorted((a, b) => a - b) // [1, 2, 11, 22]
115115
* ```

src/lib/es5.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ interface Array<T> {
13661366
* This method mutates the array and returns a reference to the same array.
13671367
* @param compareFn Function used to determine the order of the elements. It is expected to return
13681368
* a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
1369-
* value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
1369+
* value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.
13701370
* ```ts
13711371
* [11,2,22,1].sort((a, b) => a - b)
13721372
* ```

tests/baselines/reference/completionEntryForUnionMethod.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4190,7 +4190,7 @@
41904190
"kind": "space"
41914191
},
41924192
{
4193-
"text": "Function used to determine the order of the elements. It is expected to return\na negative value if the first argument is less than the second argument, zero if they're equal, and a positive\nvalue otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\n```ts\n[11,2,22,1].sort((a, b) => a - b)\n```",
4193+
"text": "Function used to determine the order of the elements. It is expected to return\na negative value if the first argument is less than the second argument, zero if they're equal, and a positive\nvalue otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.\n```ts\n[11,2,22,1].sort((a, b) => a - b)\n```",
41944194
"kind": "text"
41954195
}
41964196
]

tests/baselines/reference/goToTypeDefinition_arrayType.baseline.jsonc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
// * This method mutates the array and returns a reference to the same array.
7979
// * @param compareFn Function used to determine the order of the elements. It is expected to return
8080
// * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
81-
// * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
81+
// * value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.
8282
// * ```ts
8383
// * [11,2,22,1].sort((a, b) => a - b)
8484
// * ```
@@ -331,7 +331,7 @@
331331
// * This method mutates the array and returns a reference to the same array.
332332
// * @param compareFn Function used to determine the order of the elements. It is expected to return
333333
// * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive
334-
// * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
334+
// * value otherwise. If omitted, the elements are sorted in ascending, UTF-16 code unit order.
335335
// * ```ts
336336
// * [11,2,22,1].sort((a, b) => a - b)
337337
// * ```

tests/lib/lib.d.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ interface Array<T> {
10681068

10691069
/**
10701070
* Sorts an array.
1071-
* @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.
1071+
* @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, UTF-16 code unit order.
10721072
*/
10731073
sort(compareFn?: (a: T, b: T) => number): T[];
10741074

@@ -1612,7 +1612,7 @@ interface Int8Array {
16121612
/**
16131613
* Sorts an array.
16141614
* @param compareFn The name of the function used to determine the order of the elements. If
1615-
* omitted, the elements are sorted in ascending, ASCII character order.
1615+
* omitted, the elements are sorted in ascending, numerical order.
16161616
*/
16171617
sort(compareFn?: (a: number, b: number) => number): Int8Array;
16181618

@@ -1885,7 +1885,7 @@ interface Uint8Array {
18851885
/**
18861886
* Sorts an array.
18871887
* @param compareFn The name of the function used to determine the order of the elements. If
1888-
* omitted, the elements are sorted in ascending, ASCII character order.
1888+
* omitted, the elements are sorted in ascending, numerical order.
18891889
*/
18901890
sort(compareFn?: (a: number, b: number) => number): Uint8Array;
18911891

@@ -2159,7 +2159,7 @@ interface Uint8ClampedArray {
21592159
/**
21602160
* Sorts an array.
21612161
* @param compareFn The name of the function used to determine the order of the elements. If
2162-
* omitted, the elements are sorted in ascending, ASCII character order.
2162+
* omitted, the elements are sorted in ascending, numerical order.
21632163
*/
21642164
sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray;
21652165

@@ -2432,7 +2432,7 @@ interface Int16Array {
24322432
/**
24332433
* Sorts an array.
24342434
* @param compareFn The name of the function used to determine the order of the elements. If
2435-
* omitted, the elements are sorted in ascending, ASCII character order.
2435+
* omitted, the elements are sorted in ascending, numerical order.
24362436
*/
24372437
sort(compareFn?: (a: number, b: number) => number): Int16Array;
24382438

@@ -2706,7 +2706,7 @@ interface Uint16Array {
27062706
/**
27072707
* Sorts an array.
27082708
* @param compareFn The name of the function used to determine the order of the elements. If
2709-
* omitted, the elements are sorted in ascending, ASCII character order.
2709+
* omitted, the elements are sorted in ascending, numerical order.
27102710
*/
27112711
sort(compareFn?: (a: number, b: number) => number): Uint16Array;
27122712

@@ -2979,7 +2979,7 @@ interface Int32Array {
29792979
/**
29802980
* Sorts an array.
29812981
* @param compareFn The name of the function used to determine the order of the elements. If
2982-
* omitted, the elements are sorted in ascending, ASCII character order.
2982+
* omitted, the elements are sorted in ascending, numerical order.
29832983
*/
29842984
sort(compareFn?: (a: number, b: number) => number): Int32Array;
29852985

@@ -3252,7 +3252,7 @@ interface Uint32Array {
32523252
/**
32533253
* Sorts an array.
32543254
* @param compareFn The name of the function used to determine the order of the elements. If
3255-
* omitted, the elements are sorted in ascending, ASCII character order.
3255+
* omitted, the elements are sorted in ascending, numerical order.
32563256
*/
32573257
sort(compareFn?: (a: number, b: number) => number): Uint32Array;
32583258

@@ -3525,7 +3525,7 @@ interface Float32Array {
35253525
/**
35263526
* Sorts an array.
35273527
* @param compareFn The name of the function used to determine the order of the elements. If
3528-
* omitted, the elements are sorted in ascending, ASCII character order.
3528+
* omitted, the elements are sorted in ascending, numerical order.
35293529
*/
35303530
sort(compareFn?: (a: number, b: number) => number): Float32Array;
35313531

@@ -3799,7 +3799,7 @@ interface Float64Array {
37993799
/**
38003800
* Sorts an array.
38013801
* @param compareFn The name of the function used to determine the order of the elements. If
3802-
* omitted, the elements are sorted in ascending, ASCII character order.
3802+
* omitted, the elements are sorted in ascending, numerical order.
38033803
*/
38043804
sort(compareFn?: (a: number, b: number) => number): Float64Array;
38053805

0 commit comments

Comments
 (0)