UNPKG

1.57 kBTypeScriptView Raw
1import { Observable } from 'rxjs';
2/**
3 * Configures an effect created by `createEffect`.
4 */
5export interface EffectConfig {
6 /**
7 * Determines if the action emitted by the effect is dispatched to the store.
8 * If false, effect does not need to return type `Observable<Action>`.
9 */
10 dispatch?: boolean;
11 /**
12 * Determines whether the functional effect will be created.
13 * If true, the effect can be created outside the effects class.
14 */
15 functional?: boolean;
16 /**
17 * Determines if the effect will be resubscribed to if an error occurs in the main actions stream.
18 */
19 useEffectsErrorHandler?: boolean;
20}
21export declare const DEFAULT_EFFECT_CONFIG: Readonly<Required<EffectConfig>>;
22export declare const CREATE_EFFECT_METADATA_KEY = "__@ngrx/effects_create__";
23export interface CreateEffectMetadata {
24 [CREATE_EFFECT_METADATA_KEY]: EffectConfig;
25}
26export interface FunctionalCreateEffectMetadata extends CreateEffectMetadata {
27 [CREATE_EFFECT_METADATA_KEY]: EffectConfig & {
28 functional: true;
29 };
30}
31export type FunctionalEffect<Source extends () => Observable<unknown> = () => Observable<unknown>> = Source & FunctionalCreateEffectMetadata;
32export type EffectPropertyKey<T extends Record<keyof T, Object>> = Exclude<keyof T, keyof Object>;
33export interface EffectMetadata<T extends Record<keyof T, Object>> extends Required<EffectConfig> {
34 propertyName: EffectPropertyKey<T>;
35}
36export type EffectsMetadata<T extends Record<keyof T, Object>> = {
37 [Key in EffectPropertyKey<T>]?: EffectConfig;
38};