UNPKG

827 BTypeScriptView Raw
1/**
2 * Returns the value of the first element in the sequence that satisfies the provided testing function.
3 * Otherwise undefined is returned.
4 * @param {Iterable<T>} source Source sequence.
5 * @param {function(value: T, index: number): boolean} predicate Function to execute for every item in the sequence.
6 * @param {Object} [thisArg] Object to use as this when executing callback.
7 * @return {T | undefined} The value of the first element in the sequence that satisfies the provided testing function.
8 * Otherwise undefined is returned.
9 */
10export declare function find<T, S extends T>(source: Iterable<T>, predicate: (value: T, index: number) => value is S, thisArg?: any): S | undefined;
11export declare function find<T>(source: Iterable<T>, predicate: (value: T, index: number) => boolean, thisArg?: any): T | undefined;