1 | import { Observable } from 'rxjs';
|
2 | import { Action, ActionCreator } from '@ngrx/store';
|
3 | import { CreateEffectMetadata, EffectConfig, EffectMetadata, FunctionalEffect } from './models';
|
4 | type DispatchType<T> = T extends {
|
5 | dispatch: infer U;
|
6 | } ? U : true;
|
7 | type ObservableType<T, OriginalType> = T extends false ? OriginalType : Action;
|
8 | type EffectResult<OT> = Observable<OT> | ((...args: any[]) => Observable<OT>);
|
9 | type ConditionallyDisallowActionCreator<DT, Result> = DT extends false ? unknown : Result extends EffectResult<infer OT> ? OT extends ActionCreator ? 'ActionCreator cannot be dispatched. Did you forget to call the action creator function?' : unknown : unknown;
|
10 | export declare function createEffect<C extends EffectConfig & {
|
11 | functional?: false;
|
12 | }, DT extends DispatchType<C>, OT extends ObservableType<DT, OT>, R extends EffectResult<OT>>(source: () => R & ConditionallyDisallowActionCreator<DT, R>, config?: C): R & CreateEffectMetadata;
|
13 | export declare function createEffect<Source extends () => Observable<unknown>>(source: Source, config: EffectConfig & {
|
14 | functional: true;
|
15 | dispatch: false;
|
16 | }): FunctionalEffect<Source>;
|
17 | export declare function createEffect<Source extends () => Observable<Action>>(source: Source & ConditionallyDisallowActionCreator<true, ReturnType<Source>>, config: EffectConfig & {
|
18 | functional: true;
|
19 | dispatch?: true;
|
20 | }): FunctionalEffect<Source>;
|
21 | export declare function getCreateEffectMetadata<T extends Record<keyof T, Object>>(instance: T): EffectMetadata<T>[];
|
22 | export {};
|