import { Observable } from 'rxjs'; import { Action, ActionCreator } from '@ngrx/store'; import { EffectMetadata, EffectConfig, CreateEffectMetadata } from './models'; declare type DispatchType = T extends { dispatch: infer U; } ? U : true; declare type ObservableType = T extends false ? OriginalType : Action; declare type EffectResult = Observable | ((...args: any[]) => Observable); declare type ConditionallyDisallowActionCreator = DT extends false ? unknown : Result extends EffectResult ? OT extends ActionCreator ? 'ActionCreator cannot be dispatched. Did you forget to call the action creator function?' : unknown : unknown; /** * @description * Creates an effect from an `Observable` and an `EffectConfig`. * * @param source A function which returns an `Observable`. * @param config A `Partial` to configure the effect. By default, `dispatch` is true and `useEffectsErrorHandler` is true. * @returns If `EffectConfig`#`dispatch` is true, returns `Observable`. Else, returns `Observable`. * * @usageNotes * * ** Mapping to a different action ** * ```ts * effectName$ = createEffect( * () => this.actions$.pipe( * ofType(FeatureActions.actionOne), * map(() => FeatureActions.actionTwo()) * ) * ); * ``` * * ** Non-dispatching effects ** * ```ts * effectName$ = createEffect( * () => this.actions$.pipe( * ofType(FeatureActions.actionOne), * tap(() => console.log('Action One Dispatched')) * ), * { dispatch: false } * // FeatureActions.actionOne is not dispatched * ); * ``` */ export declare function createEffect, OT extends ObservableType, R extends EffectResult>(source: () => R & ConditionallyDisallowActionCreator, config?: Partial): R & CreateEffectMetadata; export declare function getCreateEffectMetadata(instance: T): EffectMetadata[]; export {};