source: trip-planner-front/node_modules/rxjs/internal/operators/throwIfEmpty.d.ts@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1023 bytes
Line 
1import { MonoTypeOperatorFunction } from '../types';
2/**
3 * If the source observable completes without emitting a value, it will emit
4 * an error. The error will be created at that time by the optional
5 * `errorFactory` argument, otherwise, the error will be {@link EmptyError}.
6 *
7 * ![](throwIfEmpty.png)
8 *
9 * ## Example
10 * ```ts
11 * import { fromEvent, timer } from 'rxjs';
12 * import { throwIfEmpty, takeUntil } from 'rxjs/operators';
13 *
14 * const click$ = fromEvent(document, 'click');
15 *
16 * click$.pipe(
17 * takeUntil(timer(1000)),
18 * throwIfEmpty(
19 * () => new Error('the document was not clicked within 1 second')
20 * ),
21 * )
22 * .subscribe({
23 * next() { console.log('The button was clicked'); },
24 * error(err) { console.error(err); }
25 * });
26 * ```
27 *
28 * @param errorFactory A factory function called to produce the
29 * error to be thrown when the source observable completes without emitting a
30 * value.
31 */
32export declare function throwIfEmpty<T>(errorFactory?: (() => any)): MonoTypeOperatorFunction<T>;
Note: See TracBrowser for help on using the repository browser.