UNPKG

2.67 kBTypeScriptView Raw
1import { Action, ActionCreator, Creator } from '@ngrx/store';
2import { Observable, OperatorFunction, Operator } from 'rxjs';
3export declare class Actions<V = Action> extends Observable<V> {
4 constructor(source?: Observable<V>);
5 lift<R>(operator: Operator<V, R>): Observable<R>;
6}
7declare type ActionExtractor<T extends string | AC, AC extends ActionCreator<string, Creator>, E> = T extends string ? E : ReturnType<Extract<T, AC>>;
8export declare function ofType<AC extends ActionCreator<string, Creator>[], U extends Action = Action, V = ReturnType<AC[number]>>(...allowedTypes: AC): OperatorFunction<U, V>;
9export declare function ofType<E extends Extract<U, {
10 type: T1;
11}>, AC extends ActionCreator<string, Creator>, T1 extends string | AC, U extends Action = Action, V = T1 extends string ? E : ReturnType<Extract<T1, AC>>>(t1: T1): OperatorFunction<U, V>;
12export declare function ofType<E extends Extract<U, {
13 type: T1 | T2;
14}>, AC extends ActionCreator<string, Creator>, T1 extends string | AC, T2 extends string | AC, U extends Action = Action, V = ActionExtractor<T1 | T2, AC, E>>(t1: T1, t2: T2): OperatorFunction<U, V>;
15export declare function ofType<E extends Extract<U, {
16 type: T1 | T2 | T3;
17}>, AC extends ActionCreator<string, Creator>, T1 extends string | AC, T2 extends string | AC, T3 extends string | AC, U extends Action = Action, V = ActionExtractor<T1 | T2 | T3, AC, E>>(t1: T1, t2: T2, t3: T3): OperatorFunction<U, V>;
18export declare function ofType<E extends Extract<U, {
19 type: T1 | T2 | T3 | T4;
20}>, AC extends ActionCreator<string, Creator>, T1 extends string | AC, T2 extends string | AC, T3 extends string | AC, T4 extends string | AC, U extends Action = Action, V = ActionExtractor<T1 | T2 | T3 | T4, AC, E>>(t1: T1, t2: T2, t3: T3, t4: T4): OperatorFunction<U, V>;
21export declare function ofType<E extends Extract<U, {
22 type: T1 | T2 | T3 | T4 | T5;
23}>, AC extends ActionCreator<string, Creator>, T1 extends string | AC, T2 extends string | AC, T3 extends string | AC, T4 extends string | AC, T5 extends string | AC, U extends Action = Action, V = ActionExtractor<T1 | T2 | T3 | T4 | T5, AC, E>>(t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): OperatorFunction<U, V>;
24/**
25 * Fallback for more than 5 arguments.
26 * There is no inference, so the return type is the same as the input -
27 * Observable<Action>.
28 *
29 * We provide a type parameter, even though TS will not infer it from the
30 * arguments, to preserve backwards compatibility with old versions of ngrx.
31 */
32export declare function ofType<V extends Action>(...allowedTypes: Array<string | ActionCreator<string, Creator>>): OperatorFunction<Action, V>;
33export {};