1 import { MonoTypeOperatorFunction } from '../types';
3 * Emits the single value at the specified `index` in a sequence of emissions
4 * from the source Observable.
6 * <span class="informal">Emits only the i-th value, then completes.</span>
10 * `elementAt` returns an Observable that emits the item at the specified
11 * `index` in the source Observable, or a default value if that `index` is out
12 * of range and the `default` argument is provided. If the `default` argument is
13 * not given and the `index` is out of range, the output Observable will emit an
14 * `ArgumentOutOfRangeError` error.
17 * Emit only the third click event
19 * import { fromEvent } from 'rxjs';
20 * import { elementAt } from 'rxjs/operators';
22 * const clicks = fromEvent(document, 'click');
23 * const result = clicks.pipe(elementAt(2));
24 * result.subscribe(x => console.log(x));
27 * // click 1 = nothing
28 * // click 2 = nothing
29 * // click 3 = MouseEvent object logged to console
38 * @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an
39 * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0` or the
40 * Observable has completed before emitting the i-th `next` notification.
42 * @param {number} index Is the number `i` for the i-th source emission that has
43 * happened since the subscription, starting from the number `0`.
44 * @param {T} [defaultValue] The default value returned for missing indices.
45 * @return {Observable} An Observable that emits a single item, if it is found.
46 * Otherwise, will emit the default value if given. If not, then emits an error.
50 export declare function elementAt<T>(index: number, defaultValue?: T): MonoTypeOperatorFunction<T>;