import { Result } from '@fgv/ts-utils'; /** * An experimental array template which extend built-in `Array` to include a handful * of predicates which return `Result`. * @beta */ export declare class ExtendedArray extends Array { readonly itemDescription: string; /** * Constructs an {@link Experimental.ExtendedArray | ExtendedArray}. * @param itemDescription - Brief description of the type of each item in this array. * @param items - The initial contents of the array. */ constructor(itemDescription: string, ...items: T[]); /** * Type guard to determine if some arbitrary array is an * {@link Experimental.ExtendedArray} * @param a - The `Array` to be tested. * @returns Returns `true` if `a` is an {@link Experimental.ExtendedArray | ExtendedArray}, * `false` otherwise. */ static isExtendedArray(a?: T[]): a is ExtendedArray; /** * Determines if this array contains exactly one element which matches * a supplied predicate. * @param predicate - The predicate function to be applied. * @returns Returns `Success` with the single matching * result if exactly one item matches `predicate`. Returns `Failure` * with an error message if there are no matches or more than one match. */ single(predicate?: (item: T) => boolean): Result; /** * Returns the first element of an {@link Experimental.ExtendedArray | ExtendedArray}. Fails with an * error message if the array is empty. * @param failMessage - Optional message to be displayed in the event of failure. * @returns Returns `Success` with the value of the first element * in the array, or `Failure` with an error message if the array is empty. */ first(failMessage?: string): Result; /** * Returns an array containing all elements of an {@link Experimental.ExtendedArray | ExtendedArray}. * Fails with an error message if the array is empty. * @param failMessage - Optional message to be displayed in the event of failure. * @returns Returns `Success` with a new (non-extended) `Array` * containing the elements of this array, or `Failure` with an error message * if the array is empty. */ atLeastOne(failMessage?: string): Result; /** * Gets a new (non-extended) `Array` containing all of the elements from this * {@link Experimental.ExtendedArray | ExtendedArray}. * @returns A new (non-extended) `Array`. */ all(): T[]; } //# sourceMappingURL=extendedArray.d.ts.map