Document indexOf return value when not found (#60569)

Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
This commit is contained in:
Pascal Sommer
2026-02-06 23:51:37 +01:00
committed by GitHub
parent 8bb72d2d96
commit 70c5fcaaa2
3 changed files with 26 additions and 26 deletions

View File

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

40
src/lib/es5.d.ts vendored
View File

@@ -412,14 +412,14 @@ interface String {
concat(...strings: string[]): string;
/**
* Returns the position of the first occurrence of a substring.
* Returns the position of the first occurrence of a substring, or -1 if it is not present.
* @param searchString The substring to search for in the string
* @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string.
*/
indexOf(searchString: string, position?: number): number;
/**
* Returns the last occurrence of a substring in the string.
* Returns the last occurrence of a substring in the string, or -1 if it is not present.
* @param searchString The substring to search for.
* @param position The index at which to begin searching. If omitted, the search begins at the end of the string.
*/
@@ -1955,7 +1955,7 @@ interface Int8Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
/**
* Returns the index of the first occurrence of a value in an array.
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -1970,7 +1970,7 @@ interface Int8Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
join(separator?: string): string;
/**
* Returns the index of the last occurrence of a value in an array.
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -2237,7 +2237,7 @@ interface Uint8Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
/**
* Returns the index of the first occurrence of a value in an array.
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -2252,7 +2252,7 @@ interface Uint8Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
join(separator?: string): string;
/**
* Returns the index of the last occurrence of a value in an array.
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -2519,7 +2519,7 @@ interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike = ArrayBufferLi
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
/**
* Returns the index of the first occurrence of a value in an array.
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -2534,7 +2534,7 @@ interface Uint8ClampedArray<TArrayBuffer extends ArrayBufferLike = ArrayBufferLi
join(separator?: string): string;
/**
* Returns the index of the last occurrence of a value in an array.
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -2800,7 +2800,7 @@ interface Int16Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
*/
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
/**
* Returns the index of the first occurrence of a value in an array.
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -2815,7 +2815,7 @@ interface Int16Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
join(separator?: string): string;
/**
* Returns the index of the last occurrence of a value in an array.
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -3082,7 +3082,7 @@ interface Uint16Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
/**
* Returns the index of the first occurrence of a value in an array.
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -3097,7 +3097,7 @@ interface Uint16Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
join(separator?: string): string;
/**
* Returns the index of the last occurrence of a value in an array.
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -3363,7 +3363,7 @@ interface Int32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
/**
* Returns the index of the first occurrence of a value in an array.
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -3378,7 +3378,7 @@ interface Int32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
join(separator?: string): string;
/**
* Returns the index of the last occurrence of a value in an array.
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -3644,7 +3644,7 @@ interface Uint32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
*/
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
/**
* Returns the index of the first occurrence of a value in an array.
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -3659,7 +3659,7 @@ interface Uint32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
join(separator?: string): string;
/**
* Returns the index of the last occurrence of a value in an array.
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -3926,7 +3926,7 @@ interface Float32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
/**
* Returns the index of the first occurrence of a value in an array.
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -3941,7 +3941,7 @@ interface Float32Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
join(separator?: string): string;
/**
* Returns the index of the last occurrence of a value in an array.
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -4208,7 +4208,7 @@ interface Float64Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
forEach(callbackfn: (value: number, index: number, array: this) => void, thisArg?: any): void;
/**
* Returns the index of the first occurrence of a value in an array.
* Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.
@@ -4223,7 +4223,7 @@ interface Float64Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
join(separator?: string): string;
/**
* Returns the index of the last occurrence of a value in an array.
* Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
* search starts at index 0.

View File

@@ -443,7 +443,7 @@
],
"documentation": [
{
"text": "Returns the position of the first occurrence of a substring.",
"text": "Returns the position of the first occurrence of a substring, or -1 if it is not present.",
"kind": "text"
}
],
@@ -585,7 +585,7 @@
],
"documentation": [
{
"text": "Returns the last occurrence of a substring in the string.",
"text": "Returns the last occurrence of a substring in the string, or -1 if it is not present.",
"kind": "text"
}
],