//#region src/Array/findOrThrow.d.ts /** * # findOrThrow * * ```ts * function Array.findOrThrow( * target: readonly T[], * predicate: ( * value: NoInfer, * index: number, * target: readonly NoInfer[], * ) => boolean, * ): Exclude * ``` * * Returns the first element in `array` that satisfies the provided `predicate` function, or throws an error if no element is found. * * ## Example * * ```ts [data-first] * import { Array } from "@monstermann/array"; * * Array.findOrThrow([1, 2, 3, 4], (x) => x > 2); // 3 * ``` * * ```ts [data-last] * import { Array } from "@monstermann/array"; * * pipe( * [1, 2, 3, 4], * Array.findOrThrow((x) => x > 2), * ); // 3 * ``` * */ declare const findOrThrow: { (predicate: (value: NoInfer, index: number, target: readonly NoInfer[]) => value is U): (target: readonly T[]) => Exclude; (predicate: (value: NoInfer, index: number, target: readonly NoInfer[]) => boolean): (target: readonly T[]) => Exclude; (target: readonly T[], predicate: (value: NoInfer, index: number, target: readonly NoInfer[]) => value is U): Exclude; (target: readonly T[], predicate: (value: NoInfer, index: number, target: readonly NoInfer[]) => boolean): Exclude; }; //#endregion export { findOrThrow };