UNPKG

842 BTypeScriptView Raw
1import { OptionalFindOptions } from './findoptions';
2/**
3 * Returns the last element of an async-iterable sequence that satisfies the condition in the predicate if given
4 * otherwise the last item in the sequence, or a default value if no such element exists.
5 *
6 * @export
7 * @template T The type of elements in the source sequence.
8 * @param {AsyncIterable<T>} source The source async-iterable sequence.
9 * @param {OptionalFindOptions<T, S>} [options] The options which include an optional predicate for filtering,
10 * thirArg for binding, and abort signal for cancellation
11 * @returns {(Promise<S | undefined>)} A promise containing the last value that matches the optional predicate or last item, otherwise undefined.
12 */
13export declare function last<T>(source: AsyncIterable<T>, options?: OptionalFindOptions<T>): Promise<T | undefined>;