Skip to content

Commit 70c5fca

Browse files
Document indexOf return value when not found (#60569)
Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
1 parent 8bb72d2 commit 70c5fca

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

src/lib/es2020.bigint.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ interface BigInt64Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>
223223
includes(searchElement: bigint, fromIndex?: number): boolean;
224224

225225
/**
226-
* Returns the index of the first occurrence of a value in an array.
226+
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
227227
* @param searchElement The value to locate in the array.
228228
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
229229
* search starts at index 0.
@@ -241,7 +241,7 @@ interface BigInt64Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>
241241
keys(): ArrayIterator<number>;
242242

243243
/**
244-
* Returns the index of the last occurrence of a value in an array.
244+
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
245245
* @param searchElement The value to locate in the array.
246246
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
247247
* search starts at index 0.
@@ -514,7 +514,7 @@ interface BigUint64Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>
514514
includes(searchElement: bigint, fromIndex?: number): boolean;
515515

516516
/**
517-
* Returns the index of the first occurrence of a value in an array.
517+
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
518518
* @param searchElement The value to locate in the array.
519519
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
520520
* search starts at index 0.
@@ -532,7 +532,7 @@ interface BigUint64Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>
532532
keys(): ArrayIterator<number>;
533533

534534
/**
535-
* Returns the index of the last occurrence of a value in an array.
535+
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
536536
* @param searchElement The value to locate in the array.
537537
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
538538
* search starts at index 0.

src/lib/es5.d.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -412,14 +412,14 @@ interface String {
412412
concat(...strings: string[]): string;
413413

414414
/**
415-
* Returns the position of the first occurrence of a substring.
415+
* Returns the position of the first occurrence of a substring, or -1 if it is not present.
416416
* @param searchString The substring to search for in the string
417417
* @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string.
418418
*/
419419
indexOf(searchString: string, position?: number): number;
420420

421421
/**
422-
* Returns the last occurrence of a substring in the string.
422+
* Returns the last occurrence of a substring in the string, or -1 if it is not present.
423423
* @param searchString The substring to search for.
424424
* @param position The index at which to begin searching. If omitted, the search begins at the end of the string.
425425
*/
@@ -1955,7 +1955,7 @@ interface Int8Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
19551955
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
19561956

19571957
/**
1958-
* Returns the index of the first occurrence of a value in an array.
1958+
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
19591959
* @param searchElement The value to locate in the array.
19601960
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
19611961
* search starts at index 0.
@@ -1970,7 +1970,7 @@ interface Int8Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
19701970
join(separator?: string): string;
19711971

19721972
/**
1973-
* Returns the index of the last occurrence of a value in an array.
1973+
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
19741974
* @param searchElement The value to locate in the array.
19751975
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
19761976
* search starts at index 0.
@@ -2237,7 +2237,7 @@ interface Uint8Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
22372237
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
22382238

22392239
/**
2240-
* Returns the index of the first occurrence of a value in an array.
2240+
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
22412241
* @param searchElement The value to locate in the array.
22422242
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
22432243
* search starts at index 0.
@@ -2252,7 +2252,7 @@ interface Uint8Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
22522252
join(separator?: string): string;
22532253

22542254
/**
2255-
* Returns the index of the last occurrence of a value in an array.
2255+
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
22562256
* @param searchElement The value to locate in the array.
22572257
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
22582258
* search starts at index 0.
@@ -2519,7 +2519,7 @@ interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike = ArrayBufferLi
25192519
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
25202520

25212521
/**
2522-
* Returns the index of the first occurrence of a value in an array.
2522+
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
25232523
* @param searchElement The value to locate in the array.
25242524
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
25252525
* search starts at index 0.
@@ -2534,7 +2534,7 @@ interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike = ArrayBufferLi
25342534
join(separator?: string): string;
25352535

25362536
/**
2537-
* Returns the index of the last occurrence of a value in an array.
2537+
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
25382538
* @param searchElement The value to locate in the array.
25392539
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
25402540
* search starts at index 0.
@@ -2800,7 +2800,7 @@ interface Int16Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
28002800
*/
28012801
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
28022802
/**
2803-
* Returns the index of the first occurrence of a value in an array.
2803+
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
28042804
* @param searchElement The value to locate in the array.
28052805
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
28062806
* search starts at index 0.
@@ -2815,7 +2815,7 @@ interface Int16Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
28152815
join(separator?: string): string;
28162816

28172817
/**
2818-
* Returns the index of the last occurrence of a value in an array.
2818+
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
28192819
* @param searchElement The value to locate in the array.
28202820
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
28212821
* search starts at index 0.
@@ -3082,7 +3082,7 @@ interface Uint16Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
30823082
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
30833083

30843084
/**
3085-
* Returns the index of the first occurrence of a value in an array.
3085+
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
30863086
* @param searchElement The value to locate in the array.
30873087
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
30883088
* search starts at index 0.
@@ -3097,7 +3097,7 @@ interface Uint16Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
30973097
join(separator?: string): string;
30983098

30993099
/**
3100-
* Returns the index of the last occurrence of a value in an array.
3100+
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
31013101
* @param searchElement The value to locate in the array.
31023102
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
31033103
* search starts at index 0.
@@ -3363,7 +3363,7 @@ interface Int32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
33633363
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
33643364

33653365
/**
3366-
* Returns the index of the first occurrence of a value in an array.
3366+
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
33673367
* @param searchElement The value to locate in the array.
33683368
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
33693369
* search starts at index 0.
@@ -3378,7 +3378,7 @@ interface Int32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
33783378
join(separator?: string): string;
33793379

33803380
/**
3381-
* Returns the index of the last occurrence of a value in an array.
3381+
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
33823382
* @param searchElement The value to locate in the array.
33833383
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
33843384
* search starts at index 0.
@@ -3644,7 +3644,7 @@ interface Uint32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
36443644
*/
36453645
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
36463646
/**
3647-
* Returns the index of the first occurrence of a value in an array.
3647+
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
36483648
* @param searchElement The value to locate in the array.
36493649
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
36503650
* search starts at index 0.
@@ -3659,7 +3659,7 @@ interface Uint32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
36593659
join(separator?: string): string;
36603660

36613661
/**
3662-
* Returns the index of the last occurrence of a value in an array.
3662+
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
36633663
* @param searchElement The value to locate in the array.
36643664
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
36653665
* search starts at index 0.
@@ -3926,7 +3926,7 @@ interface Float32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
39263926
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
39273927

39283928
/**
3929-
* Returns the index of the first occurrence of a value in an array.
3929+
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
39303930
* @param searchElement The value to locate in the array.
39313931
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
39323932
* search starts at index 0.
@@ -3941,7 +3941,7 @@ interface Float32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
39413941
join(separator?: string): string;
39423942

39433943
/**
3944-
* Returns the index of the last occurrence of a value in an array.
3944+
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
39453945
* @param searchElement The value to locate in the array.
39463946
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
39473947
* search starts at index 0.
@@ -4208,7 +4208,7 @@ interface Float64Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
42084208
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
42094209

42104210
/**
4211-
* Returns the index of the first occurrence of a value in an array.
4211+
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
42124212
* @param searchElement The value to locate in the array.
42134213
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
42144214
* search starts at index 0.
@@ -4223,7 +4223,7 @@ interface Float64Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
42234223
join(separator?: string): string;
42244224

42254225
/**
4226-
* Returns the index of the last occurrence of a value in an array.
4226+
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
42274227
* @param searchElement The value to locate in the array.
42284228
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
42294229
* search starts at index 0.

tests/baselines/reference/completionsStringMethods.baseline

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@
443443
],
444444
"documentation": [
445445
{
446-
"text": "Returns the position of the first occurrence of a substring.",
446+
"text": "Returns the position of the first occurrence of a substring, or -1 if it is not present.",
447447
"kind": "text"
448448
}
449449
],
@@ -585,7 +585,7 @@
585585
],
586586
"documentation": [
587587
{
588-
"text": "Returns the last occurrence of a substring in the string.",
588+
"text": "Returns the last occurrence of a substring in the string, or -1 if it is not present.",
589589
"kind": "text"
590590
}
591591
],

0 commit comments

Comments
 (0)