import type { Action , ActionCreator , Creator } from "@ngrx/store" ; import type { OperatorFunction } from "rxjs" ; import { filter } from "rxjs/operators" ; type ActionExtractor < T extends string | AC , AC extends ActionCreator < string , Creator > , E > = T extends string ? E : ReturnType < Extract < T , AC > > ; export function ofType < AC extends ActionCreator < string , Creator > [ ] , U extends Action = Action , V = ReturnType < AC [ number ] > > ( ... allowedTypes ) ; export function ofType < E extends Extract < U , { type : T1 ; } > , AC extends ActionCreator < string , Creator > , T1 extends string | AC , U extends Action = Action , V = T1 extends string ? E : ReturnType < Extract < T1 , AC > > > ( t1 ) ; export function ofType < E extends Extract < U , { type : T1 | T2 ; } > , AC extends ActionCreator < string , Creator > , T1 extends string | AC , T2 extends string | AC , U extends Action = Action , V = ActionExtractor < T1 | T2 , AC , E > > ( t1 , t2 ) ; export function ofType < E extends Extract < U , { type : T1 | T2 | T3 ; } > , 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 , t2 , t3 ) ; export function ofType < E extends Extract < U , { type : T1 | T2 | T3 | T4 ; } > , 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 , t2 , t3 , t4 ) ; export function ofType < E extends Extract < U , { type : T1 | T2 | T3 | T4 | T5 ; } > , 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 , t2 , t3 , t4 , t5 ) ; /**
 * Fallback for more than 5 arguments.
 * There is no inference, so the return type is the same as the input -
 * Observable<Action>.
 *
 * We provide a type parameter, even though TS will not infer it from the
 * arguments, to preserve backwards compatibility with old versions of ngrx.
 */ export function ofType < V extends Action > ( ... allowedTypes ) ; usageNotes export function ofType ( ... allowedTypes ) { return filter ( ( action ) => allowedTypes . some ( ( typeOrActionCreator ) => { if ( typeof typeOrActionCreator === 'string' ) { return typeOrActionCreator === action . type ; } return typeOrActionCreator . type === action . type ; } ) ) ; }