@ngrx/store
- Version 19.0.0
- Published
- 636 kB
- 1 dependency
- MIT license
Install
npm i @ngrx/store
yarn add @ngrx/store
pnpm add @ngrx/store
Overview
RxJS powered Redux for Angular apps
Index
Variables
Functions
- combineReducers()
- compose()
- createAction()
- createActionGroup()
- createFeature()
- createFeatureSelector()
- createReducer()
- createReducerFactory()
- createSelector()
- createSelectorFactory()
- defaultMemoize()
- defaultStateFn()
- emptyProps()
- isNgrxMockEnvironment()
- on()
- props()
- provideState()
- provideStore()
- reduceState()
- resultMemoize()
- select()
- setNgrxMockEnvironment()
- union()
Classes
Interfaces
Type Aliases
Variables
variable ACTIVE_RUNTIME_CHECKS
const ACTIVE_RUNTIME_CHECKS: InjectionToken<RuntimeChecks>;
Runtime checks currently in use
variable FEATURE_REDUCERS
const FEATURE_REDUCERS: InjectionToken<unknown>;
variable FEATURE_STATE_PROVIDER
const FEATURE_STATE_PROVIDER: InjectionToken<void>;
InjectionToken that registers feature states. Mainly used to provide a hook that can be injected to ensure feature state is loaded before something that depends on it.
variable INIT
const INIT: string;
variable INITIAL_REDUCERS
const INITIAL_REDUCERS: InjectionToken<unknown>;
variable INITIAL_STATE
const INITIAL_STATE: InjectionToken<unknown>;
variable META_REDUCERS
const META_REDUCERS: InjectionToken<MetaReducer<any, Action<string>>[]>;
Meta reducers defined either internally by @ngrx/store or by library authors
variable REDUCER_FACTORY
const REDUCER_FACTORY: InjectionToken<unknown>;
variable ROOT_STORE_PROVIDER
const ROOT_STORE_PROVIDER: InjectionToken<void>;
InjectionToken that registers the global Store. Mainly used to provide a hook that can be injected to ensure the root state is loaded before something that depends on it.
variable STORE_FEATURES
const STORE_FEATURES: InjectionToken<unknown>;
variable UPDATE
const UPDATE: string;
variable USER_PROVIDED_META_REDUCERS
const USER_PROVIDED_META_REDUCERS: InjectionToken< MetaReducer<any, Action<string>>[]>;
User-defined meta reducers from StoreModule.forRoot()
variable USER_RUNTIME_CHECKS
const USER_RUNTIME_CHECKS: InjectionToken<RuntimeChecks>;
Runtime checks defined by the user via an InjectionToken Defaults to
_USER_RUNTIME_CHECKS
Functions
function combineReducers
combineReducers: <T, V extends Action<string> = Action<string>>( reducers: ActionReducerMap<T, V>, initialState?: Partial<T>) => ActionReducer<T, V>;
function compose
compose: { <A>(): (i: A) => A; <A, B>(b: (i: A) => B): (i: A) => B; <A, B, C>(c: (i: B) => C, b: (i: A) => B): (i: A) => C; <A, B, C, D>(d: (i: C) => D, c: (i: B) => C, b: (i: A) => B): (i: A) => D; <A, B, C, D, E>( e: (i: D) => E, d: (i: C) => D, c: (i: B) => C, b: (i: A) => B ): (i: A) => E; <A, B, C, D, E, F>( f: (i: E) => F, e: (i: D) => E, d: (i: C) => D, c: (i: B) => C, b: (i: A) => B ): (i: A) => F; <A = any, F = any>(...functions: any[]): (i: A) => F;};
function createAction
createAction: { <T extends string>(type: T): ActionCreator<T, () => Action<T>>; <T extends string, P extends object>( type: T, config: ActionCreatorProps<P> & NotAllowedCheck<P> ): ActionCreator<T, (props: P & NotAllowedCheck<P>) => P & Action<T>>; <T extends string, P extends any[], R extends object>( type: T, creator: Creator<P, R & NotAllowedCheck<R>> ): FunctionWithParametersType<P, R & Action<T>> & Action<T>;};
function createActionGroup
createActionGroup: < Source extends string, Events extends Record< string, Creator<any[], object> | ActionCreatorProps<unknown> >>( config: ActionGroupConfig<Source, Events>) => ActionGroup<Source, Events>;
A function that creates a group of action creators with the same source.
Parameter config
An object that contains a source and dictionary of events. An event is a key-value pair of an event name and event props.
Returns
A dictionary of action creators. The name of each action creator is created by camel casing the event name. The type of each action is created using the "[Source] Event Name" pattern.
const authApiActions = createActionGroup({source: 'Auth API',events: {// defining events with payload using the `props` function'Login Success': props<{ userId: number; token: string }>(),'Login Failure': props<{ error: string }>(),// defining an event without payload using the `emptyProps` function'Logout Success': emptyProps(),// defining an event with payload using the props factory'Logout Failure': (error: Error) => ({ error }),},});// action type: "[Auth API] Login Success"authApiActions.loginSuccess({ userId: 10, token: 'ngrx' });// action type: "[Auth API] Login Failure"authApiActions.loginFailure({ error: 'Login Failure!' });// action type: "[Auth API] Logout Success"authApiActions.logoutSuccess();// action type: "[Auth API] Logout Failure";authApiActions.logoutFailure(new Error('Logout Failure!'));
function createFeature
createFeature: { < FeatureName extends string, FeatureState, ExtraSelectors extends SelectorsDictionary >( featureConfig: FeatureConfig<FeatureName, FeatureState> & { extraSelectors: ExtraSelectorsFactory< FeatureName, FeatureState, ExtraSelectors >; } & NotAllowedFeatureStateCheck<FeatureState> ): Prettify< FeatureWithExtraSelectors<FeatureName, FeatureState, ExtraSelectors> >; <FeatureName extends string, FeatureState>( featureConfig: FeatureConfig<FeatureName, FeatureState> & NotAllowedFeatureStateCheck<FeatureState> ): { [K in keyof Feature<FeatureName, FeatureState>]: Feature< FeatureName, FeatureState >[K]; };};
Creates a feature object with extra selectors.
Parameter featureConfig
An object that contains a feature name, a feature reducer, and extra selectors factory.
Returns
An object that contains a feature name, a feature reducer, a feature selector, a selector for each feature state property, and extra selectors.
Creates a feature object.
Parameter featureConfig
An object that contains a feature name and a feature reducer.
Returns
An object that contains a feature name, a feature reducer, a feature selector, and a selector for each feature state property.
function createFeatureSelector
createFeatureSelector: { <T>(featureName: string): MemoizedSelector<object, T>; <T, V>(featureName: keyof T): MemoizedSelector<T, V, DefaultProjectorFn<V>>;};
Deprecated
Feature selectors with a root state are deprecated, for more info see
function createReducer
createReducer: < S, A extends Action<string> = Action<string>, R extends ActionReducer<S, A> = ActionReducer<S, A>>( initialState: S, ...ons: ReducerTypes<S, readonly ActionCreator[]>[]) => R;
Creates a reducer function to handle state transitions.
Reducer creators reduce the explicitness of reducer functions with switch statements.
Parameter initialState
Provides a state value if the current state is
undefined
, as it is initially.Parameter ons
Associations between actions and state changes.
Returns
A reducer function.
- Must be used with
ActionCreator
's (returned bycreateAction
). Cannot be used with class-based action creators. - The returnedActionReducer
does not require being wrapped with another function.**Declaring a reducer creator**
export const reducer = createReducer(initialState,on(featureActions.actionOne,featureActions.actionTwo,(state, { updatedValue }) => ({ ...state, prop: updatedValue })),on(featureActions.actionThree, () => initialState););
function createReducerFactory
createReducerFactory: <T, V extends Action<string> = Action<string>>( reducerFactory: ActionReducerFactory<T, V>, metaReducers?: MetaReducer<T, V>[]) => ActionReducerFactory<T, V>;
function createSelector
createSelector: { <State, S1, Result>( s1: Selector<State, S1>, projector: (s1: S1) => Result ): MemoizedSelector<State, Result, typeof projector>; <State, S1, S2, Result>( s1: Selector<State, S1>, s2: Selector<State, S2>, projector: (s1: S1, s2: S2) => Result ): MemoizedSelector<State, Result, (s1: S1, s2: S2) => Result>; <State, S1, S2, S3, Result>( s1: Selector<State, S1>, s2: Selector<State, S2>, s3: Selector<State, S3>, projector: (s1: S1, s2: S2, s3: S3) => Result ): MemoizedSelector<State, Result, (s1: S1, s2: S2, s3: S3) => Result>; <State, S1, S2, S3, S4, Result>( s1: Selector<State, S1>, s2: Selector<State, S2>, s3: Selector<State, S3>, s4: Selector<State, S4>, projector: (s1: S1, s2: S2, s3: S3, s4: S4) => Result ): MemoizedSelector<State, Result, (s1: S1, s2: S2, s3: S3, s4: S4) => Result>; <State, S1, S2, S3, S4, S5, Result>( s1: Selector<State, S1>, s2: Selector<State, S2>, s3: Selector<State, S3>, s4: Selector<State, S4>, s5: Selector<State, S5>, projector: (s1: S1, s2: S2, s3: S3, s4: S4, s5: S5) => Result ): MemoizedSelector< State, Result, (s1: S1, s2: S2, s3: S3, s4: S4, s5: S5) => Result >; <State, S1, S2, S3, S4, S5, S6, Result>( s1: Selector<State, S1>, s2: Selector<State, S2>, s3: Selector<State, S3>, s4: Selector<State, S4>, s5: Selector<State, S5>, s6: Selector<State, S6>, projector: (s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6) => Result ): MemoizedSelector< State, Result, (s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6) => Result >; <State, S1, S2, S3, S4, S5, S6, S7, Result>( s1: Selector<State, S1>, s2: Selector<State, S2>, s3: Selector<State, S3>, s4: Selector<State, S4>, s5: Selector<State, S5>, s6: Selector<State, S6>, s7: Selector<State, S7>, projector: (s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, s7: S7) => Result ): MemoizedSelector< State, Result, (s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, s7: S7) => Result >; <State, S1, S2, S3, S4, S5, S6, S7, S8, Result>( s1: Selector<State, S1>, s2: Selector<State, S2>, s3: Selector<State, S3>, s4: Selector<State, S4>, s5: Selector<State, S5>, s6: Selector<State, S6>, s7: Selector<State, S7>, s8: Selector<State, S8>, projector: ( s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, s7: S7, s8: S8 ) => Result ): MemoizedSelector< State, Result, (s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, s7: S7, s8: S8) => Result >; < Selectors extends Record<string, Selector<State, unknown>>, State = Selectors extends Record<string, Selector<infer S, unknown>> ? S : never, Result extends Record<string, unknown> = { [Key in keyof Selectors]: Selectors[Key] extends Selector<State, infer R> ? R : never; } >( selectors: Selectors ): MemoizedSelector<State, Result, never>; <State, Slices extends unknown[], Result>( ...args: [...slices: Selector<State, unknown>[], projector: unknown] & [ ...slices: { [i in keyof Slices]: Selector<State, Slices[i]> }, projector: (...s: Slices) => Result ] ): MemoizedSelector<State, Result, (...s: Slices) => Result>; <State, Props, S1, Result>( s1: SelectorWithProps<State, Props, S1>, projector: (s1: S1, props: Props) => Result ): MemoizedSelectorWithProps< State, Props, Result, (s1: S1, props: Props) => Result >; <State, Props, S1, S2, Result>( s1: SelectorWithProps<State, Props, S1>, s2: SelectorWithProps<State, Props, S2>, projector: (s1: S1, s2: S2, props: Props) => Result ): MemoizedSelectorWithProps< State, Props, Result, (s1: S1, s2: S2, props: Props) => Result >; <State, Props, S1, S2, S3, Result>( s1: SelectorWithProps<State, Props, S1>, s2: SelectorWithProps<State, Props, S2>, s3: SelectorWithProps<State, Props, S3>, projector: (s1: S1, s2: S2, s3: S3, props: Props) => Result ): MemoizedSelectorWithProps< State, Props, Result, (s1: S1, s2: S2, s3: S3, props: Props) => Result >; <State, Props, S1, S2, S3, S4, Result>( s1: SelectorWithProps<State, Props, S1>, s2: SelectorWithProps<State, Props, S2>, s3: SelectorWithProps<State, Props, S3>, s4: SelectorWithProps<State, Props, S4>, projector: (s1: S1, s2: S2, s3: S3, s4: S4, props: Props) => Result ): MemoizedSelectorWithProps< State, Props, Result, (s1: S1, s2: S2, s3: S3, s4: S4, props: Props) => Result >; <State, Props, S1, S2, S3, S4, S5, Result>( s1: SelectorWithProps<State, Props, S1>, s2: SelectorWithProps<State, Props, S2>, s3: SelectorWithProps<State, Props, S3>, s4: SelectorWithProps<State, Props, S4>, s5: SelectorWithProps<State, Props, S5>, projector: (s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, props: Props) => Result ): MemoizedSelectorWithProps< State, Props, Result, (s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, props: Props) => Result >; <State, Props, S1, S2, S3, S4, S5, S6, Result>( s1: SelectorWithProps<State, Props, S1>, s2: SelectorWithProps<State, Props, S2>, s3: SelectorWithProps<State, Props, S3>, s4: SelectorWithProps<State, Props, S4>, s5: SelectorWithProps<State, Props, S5>, s6: SelectorWithProps<State, Props, S6>, projector: ( s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, props: Props ) => Result ): MemoizedSelectorWithProps< State, Props, Result, (s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, props: Props) => Result >; <State, Props, S1, S2, S3, S4, S5, S6, S7, Result>( s1: SelectorWithProps<State, Props, S1>, s2: SelectorWithProps<State, Props, S2>, s3: SelectorWithProps<State, Props, S3>, s4: SelectorWithProps<State, Props, S4>, s5: SelectorWithProps<State, Props, S5>, s6: SelectorWithProps<State, Props, S6>, s7: SelectorWithProps<State, Props, S7>, projector: ( s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, s7: S7, props: Props ) => Result ): MemoizedSelectorWithProps< State, Props, Result, ( s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, s7: S7, props: Props ) => Result >; <State, Props, S1, S2, S3, S4, S5, S6, S7, S8, Result>( s1: SelectorWithProps<State, Props, S1>, s2: SelectorWithProps<State, Props, S2>, s3: SelectorWithProps<State, Props, S3>, s4: SelectorWithProps<State, Props, S4>, s5: SelectorWithProps<State, Props, S5>, s6: SelectorWithProps<State, Props, S6>, s7: SelectorWithProps<State, Props, S7>, s8: SelectorWithProps<State, Props, S8>, projector: ( s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, s7: S7, s8: S8, props: Props ) => Result ): MemoizedSelectorWithProps< State, Props, Result, ( s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, s7: S7, s8: S8, props: Props ) => Result >; <State, Slices extends unknown[], Result>( selectors: Selector<State, unknown>[] & [...{ [i in keyof Slices]: Selector<State, Slices[i]> }], projector: (...s: Slices) => Result ): MemoizedSelector<State, Result, (...s: Slices) => Result>; <State, Props, S1, Result>( selectors: [SelectorWithProps<State, Props, S1>], projector: (s1: S1, props: Props) => Result ): MemoizedSelectorWithProps< State, Props, Result, (s1: S1, props: Props) => Result >; <State, Props, S1, S2, Result>( selectors: [ SelectorWithProps<State, Props, S1>, SelectorWithProps<State, Props, S2> ], projector: (s1: S1, s2: S2, props: Props) => Result ): MemoizedSelectorWithProps< State, Props, Result, (s1: S1, s2: S2, props: Props) => Result >; <State, Props, S1, S2, S3, Result>( selectors: [ SelectorWithProps<State, Props, S1>, SelectorWithProps<State, Props, S2>, SelectorWithProps<State, Props, S3> ], projector: (s1: S1, s2: S2, s3: S3, props: Props) => Result ): MemoizedSelectorWithProps< State, Props, Result, (s1: S1, s2: S2, s3: S3, props: Props) => Result >; <State, Props, S1, S2, S3, S4, Result>( selectors: [ SelectorWithProps<State, Props, S1>, SelectorWithProps<State, Props, S2>, SelectorWithProps<State, Props, S3>, SelectorWithProps<State, Props, S4> ], projector: (s1: S1, s2: S2, s3: S3, s4: S4, props: Props) => Result ): MemoizedSelectorWithProps< State, Props, Result, (s1: S1, s2: S2, s3: S3, s4: S4, props: Props) => Result >; <State, Props, S1, S2, S3, S4, S5, Result>( selectors: [ SelectorWithProps<State, Props, S1>, SelectorWithProps<State, Props, S2>, SelectorWithProps<State, Props, S3>, SelectorWithProps<State, Props, S4>, SelectorWithProps<State, Props, S5> ], projector: (s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, props: Props) => Result ): MemoizedSelectorWithProps< State, Props, Result, (s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, props: Props) => Result >; <State, Props, S1, S2, S3, S4, S5, S6, Result>( selectors: [ SelectorWithProps<State, Props, S1>, SelectorWithProps<State, Props, S2>, SelectorWithProps<State, Props, S3>, SelectorWithProps<State, Props, S4>, SelectorWithProps<State, Props, S5>, SelectorWithProps<State, Props, S6> ], projector: ( s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, props: Props ) => Result ): MemoizedSelectorWithProps< State, Props, Result, (s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, props: Props) => Result >; <State, Props, S1, S2, S3, S4, S5, S6, S7, Result>( selectors: [ SelectorWithProps<State, Props, S1>, SelectorWithProps<State, Props, S2>, SelectorWithProps<State, Props, S3>, SelectorWithProps<State, Props, S4>, SelectorWithProps<State, Props, S5>, SelectorWithProps<State, Props, S6>, SelectorWithProps<State, Props, S7> ], projector: ( s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, s7: S7, props: Props ) => Result ): MemoizedSelectorWithProps< State, Props, Result, ( s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, s7: S7, props: Props ) => Result >; <State, Props, S1, S2, S3, S4, S5, S6, S7, S8, Result>( selectors: [ SelectorWithProps<State, Props, S1>, SelectorWithProps<State, Props, S2>, SelectorWithProps<State, Props, S3>, SelectorWithProps<State, Props, S4>, SelectorWithProps<State, Props, S5>, SelectorWithProps<State, Props, S6>, SelectorWithProps<State, Props, S7>, SelectorWithProps<State, Props, S8> ], projector: ( s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, s7: S7, s8: S8, props: Props ) => Result ): MemoizedSelectorWithProps< State, Props, Result, ( s1: S1, s2: S2, s3: S3, s4: S4, s5: S5, s6: S6, s7: S7, s8: S8, props: Props ) => Result >;};
Deprecated
Selectors with props are deprecated, for more info see
function createSelectorFactory
createSelectorFactory: { <T = any, V = any>(memoize: MemoizeFn): ( ...input: any[] ) => MemoizedSelector<T, V>; <T = any, V = any>(memoize: MemoizeFn, options: SelectorFactoryConfig<T, V>): ( ...input: any[] ) => MemoizedSelector<T, V, DefaultProjectorFn<V>>; <T = any, Props = any, V = any>(memoize: MemoizeFn): ( ...input: any[] ) => MemoizedSelectorWithProps<T, Props, V, DefaultProjectorFn<V>>; <T = any, Props = any, V = any>( memoize: MemoizeFn, options: SelectorFactoryConfig<T, V> ): ( ...input: any[] ) => MemoizedSelectorWithProps<T, Props, V, DefaultProjectorFn<V>>;};
Deprecated
Selectors with props are deprecated, for more info see
function defaultMemoize
defaultMemoize: ( projectionFn: AnyFn, isArgumentsEqual?: typeof isEqualCheck, isResultEqual?: typeof isEqualCheck) => MemoizedProjection;
function defaultStateFn
defaultStateFn: ( state: any, selectors: Selector<any, any>[] | SelectorWithProps<any, any, any>[], props: any, memoizedProjector: MemoizedProjection) => any;
function emptyProps
emptyProps: () => ActionCreatorProps<void>;
function isNgrxMockEnvironment
isNgrxMockEnvironment: () => boolean;
function on
on: < State, Creators extends readonly ActionCreator<string, Creator<any[], object>>[], InferredState = State>( ...args: [ ...creators: Creators, reducer: OnReducer< State extends infer S ? S : never, Creators, InferredState, unknown extends (State extends infer S ? S : never) ? InferredState : State extends infer S ? S : never > ]) => ReducerTypes<unknown extends State ? InferredState : State, Creators>;
Associates actions with a given state change function. A state change function must be provided as the last parameter.
Parameter args
ActionCreator
's followed by a state change function.Returns
an association of action types with a state change function.
on(AuthApiActions.loginSuccess, (state, { user }) => ({ ...state, user }))
function props
props: < P extends SafeProps, SafeProps = NotAllowedInPropsCheck<P>>() => ActionCreatorProps<P>;
function provideState
provideState: { <T, V extends Action<string> = Action<string>>( featureName: string, reducers: ActionReducerMap<T, V> | InjectionToken<ActionReducerMap<T, V>>, config?: StoreConfig<T, V> | InjectionToken<StoreConfig<T, V>> ): EnvironmentProviders; <T, V extends Action<string> = Action<string>>( featureName: string, reducer: any, config?: any ): EnvironmentProviders; <T, V extends Action<string> = Action<string>>( slice: FeatureSlice<T, V> ): EnvironmentProviders;};
function provideStore
provideStore: <T, V extends Action<string> = Action<string>>( reducers?: ActionReducerMap<T, V> | InjectionToken<ActionReducerMap<T, V>>, config?: RootStoreConfig<T, V>) => EnvironmentProviders;
Provides the global Store providers and initializes the Store. These providers cannot be used at the component level.
### Providing the Global Store
bootstrapApplication(AppComponent, {providers: [provideStore()],});
function reduceState
reduceState: <T, V extends Action<string> = Action<string>>( stateActionPair: StateActionPair<T, V> | undefined, [action, reducer]: [V, ActionReducer<T, V>]) => StateActionPair<T, V>;
function resultMemoize
resultMemoize: ( projectionFn: AnyFn, isResultEqual: ComparatorFn) => MemoizedProjection;
function select
select: { <T, K>(mapFn: (state: T) => K): (source$: Observable<T>) => Observable<K>; <T, Props, K>(mapFn: (state: T, props: Props) => K, props: Props): ( source$: Observable<T> ) => Observable<K>; <T, a extends keyof T>(key: a): (source$: Observable<T>) => Observable<T[a]>; <T, a extends keyof T, b extends keyof T[a]>(key1: a, key2: b): ( source$: Observable<T> ) => Observable<T[a][b]>; <T, a extends keyof T, b extends keyof T[a], c extends keyof T[a][b]>( key1: a, key2: b, key3: c ): (source$: Observable<T>) => Observable<T[a][b][c]>; < T, a extends keyof T, b extends keyof T[a], c extends keyof T[a][b], d extends keyof T[a][b][c] >( key1: a, key2: b, key3: c, key4: d ): (source$: Observable<T>) => Observable<T[a][b][c][d]>; < T, a extends keyof T, b extends keyof T[a], c extends keyof T[a][b], d extends keyof T[a][b][c], e extends keyof T[a][b][c][d] >( key1: a, key2: b, key3: c, key4: d, key5: e ): (source$: Observable<T>) => Observable<T[a][b][c][d][e]>; < T, a extends keyof T, b extends keyof T[a], c extends keyof T[a][b], d extends keyof T[a][b][c], e extends keyof T[a][b][c][d], f extends keyof T[a][b][c][d][e] >( key1: a, key2: b, key3: c, key4: d, key5: e, key6: f ): (source$: Observable<T>) => Observable<T[a][b][c][d][e][f]>; < T, a extends keyof T, b extends keyof T[a], c extends keyof T[a][b], d extends keyof T[a][b][c], e extends keyof T[a][b][c][d], f extends keyof T[a][b][c][d][e], K = any >( key1: a, key2: b, key3: c, key4: d, key5: e, key6: f, ...paths: string[] ): (source$: Observable<T>) => Observable<K>;};
Deprecated
Selectors with props are deprecated, for more info see
function setNgrxMockEnvironment
setNgrxMockEnvironment: (value: boolean) => void;
function union
union: < C extends { [key: string]: ActionCreator<string, Creator<any[], object>> }>( creators: C) => ReturnType<C[keyof C]>;
Classes
class ActionsSubject
class ActionsSubject extends BehaviorSubject<Action> implements OnDestroy {}
constructor
constructor();
property ɵfac
static ɵfac: i0.ɵɵFactoryDeclaration<ActionsSubject, never>;
property ɵprov
static ɵprov: i0.ɵɵInjectableDeclaration<ActionsSubject>;
method complete
complete: () => void;
method next
next: (action: Action) => void;
method ngOnDestroy
ngOnDestroy: () => void;
class ReducerManager
class ReducerManager extends BehaviorSubject<ActionReducer<any, any>> implements OnDestroy {}
constructor
constructor( dispatcher: ReducerManagerDispatcher, initialState: any, reducers: ActionReducerMap<any, any>, reducerFactory: ActionReducerFactory<any, any>);
property currentReducers
readonly currentReducers: ActionReducerMap<any, any>;
property ɵfac
static ɵfac: i0.ɵɵFactoryDeclaration<ReducerManager, never>;
property ɵprov
static ɵprov: i0.ɵɵInjectableDeclaration<ReducerManager>;
method addFeature
addFeature: (feature: StoreFeature<any, any>) => void;
method addFeatures
addFeatures: (features: StoreFeature<any, any>[]) => void;
method addReducer
addReducer: (key: string, reducer: ActionReducer<any, any>) => void;
method addReducers
addReducers: (reducers: { [key: string]: ActionReducer<any, any> }) => void;
method ngOnDestroy
ngOnDestroy: () => void;
method removeFeature
removeFeature: (feature: StoreFeature<any, any>) => void;
method removeFeatures
removeFeatures: (features: StoreFeature<any, any>[]) => void;
method removeReducer
removeReducer: (featureKey: string) => void;
method removeReducers
removeReducers: (featureKeys: string[]) => void;
class ReducerManagerDispatcher
abstract class ReducerManagerDispatcher extends ActionsSubject {}
class ReducerObservable
abstract class ReducerObservable extends Observable<ActionReducer<any, any>> {}
class ScannedActionsSubject
class ScannedActionsSubject extends Subject<Action> implements OnDestroy {}
property ɵfac
static ɵfac: i0.ɵɵFactoryDeclaration<ScannedActionsSubject, never>;
property ɵprov
static ɵprov: i0.ɵɵInjectableDeclaration<ScannedActionsSubject>;
method ngOnDestroy
ngOnDestroy: () => void;
class State
class State<T> extends BehaviorSubject<any> implements OnDestroy {}
constructor
constructor( actions$: ActionsSubject, reducer$: ReducerObservable, scannedActions: ScannedActionsSubject, initialState: any);
property INIT
static readonly INIT: string;
property ɵfac
static ɵfac: i0.ɵɵFactoryDeclaration<State<any>, never>;
property ɵprov
static ɵprov: i0.ɵɵInjectableDeclaration<State<any>>;
method ngOnDestroy
ngOnDestroy: () => void;
class StateObservable
abstract class StateObservable extends Observable<any> {}
class Store
class Store<T = object> extends Observable<T> implements Observer<Action> {}
constructor
constructor( state$: StateObservable, actionsObserver: ActionsSubject, reducerManager: ReducerManager, injector?: any);
property ɵfac
static ɵfac: i0.ɵɵFactoryDeclaration<Store<any>, never>;
property ɵprov
static ɵprov: i0.ɵɵInjectableDeclaration<Store<any>>;
method addReducer
addReducer: <State, Actions extends Action<string> = Action<string>>( key: string, reducer: ActionReducer<State, Actions>) => void;
method complete
complete: () => void;
method dispatch
dispatch: { <V extends Action<string>>(action: V & CreatorsNotAllowedCheck<V>): void; <V extends () => Action<string>>( dispatchFn: V & CreatorsNotAllowedCheck<V>, config?: { injector: Injector } ): EffectRef;};
method error
error: (err: any) => void;
method lift
lift: <R>(operator: Operator<T, R>) => Store<R>;
method next
next: (action: Action) => void;
method removeReducer
removeReducer: <Key extends Extract<keyof T, string>>(key: Key) => void;
method select
select: { <K>(mapFn: (state: T) => K): Observable<K>; <K, Props = any>( mapFn: (state: T, props: Props) => K, props: Props ): Observable<K>; <a extends keyof T>(key: a): Observable<T[a]>; <a extends keyof T, b extends keyof T[a]>(key1: a, key2: b): Observable< T[a][b] >; <a extends keyof T, b extends keyof T[a], c extends keyof T[a][b]>( key1: a, key2: b, key3: c ): Observable<T[a][b][c]>; < a extends keyof T, b extends keyof T[a], c extends keyof T[a][b], d extends keyof T[a][b][c] >( key1: a, key2: b, key3: c, key4: d ): Observable<T[a][b][c][d]>; < a extends keyof T, b extends keyof T[a], c extends keyof T[a][b], d extends keyof T[a][b][c], e extends keyof T[a][b][c][d] >( key1: a, key2: b, key3: c, key4: d, key5: e ): Observable<T[a][b][c][d][e]>; < a extends keyof T, b extends keyof T[a], c extends keyof T[a][b], d extends keyof T[a][b][c], e extends keyof T[a][b][c][d], f extends keyof T[a][b][c][d][e] >( key1: a, key2: b, key3: c, key4: d, key5: e, key6: f ): Observable<T[a][b][c][d][e][f]>; < a extends keyof T, b extends keyof T[a], c extends keyof T[a][b], d extends keyof T[a][b][c], e extends keyof T[a][b][c][d], f extends keyof T[a][b][c][d][e], K = any >( key1: a, key2: b, key3: c, key4: d, key5: e, key6: f, ...paths: string[] ): Observable<K>;};
Deprecated
Selectors with props are deprecated, for more info see
method selectSignal
selectSignal: <K>( selector: (state: T) => K, options?: SelectSignalOptions<K>) => Signal<K>;
Returns a signal of the provided selector.
Parameter selector
selector function
Parameter options
select signal options
class StoreFeatureModule
class StoreFeatureModule implements OnDestroy {}
constructor
constructor( features: StoreFeature<any, any>[], featureReducers: ActionReducerMap<any, Action<string>>[], reducerManager: ReducerManager, root: StoreRootModule, actionCheck: any);
property ɵfac
static ɵfac: i0.ɵɵFactoryDeclaration< StoreFeatureModule, [null, null, null, null, { optional: true }]>;
property ɵinj
static ɵinj: i0.ɵɵInjectorDeclaration<StoreFeatureModule>;
property ɵmod
static ɵmod: i0.ɵɵNgModuleDeclaration<StoreFeatureModule, never, never, never>;
method ngOnDestroy
ngOnDestroy: () => void;
class StoreModule
class StoreModule {}
property ɵfac
static ɵfac: i0.ɵɵFactoryDeclaration<StoreModule, never>;
property ɵinj
static ɵinj: i0.ɵɵInjectorDeclaration<StoreModule>;
property ɵmod
static ɵmod: i0.ɵɵNgModuleDeclaration<StoreModule, never, never, never>;
method forFeature
static forFeature: { <T, V extends Action<string> = Action<string>>( featureName: string, reducers: | ActionReducerMap<T, V> | InjectionToken<ActionReducerMap<T, V>>, config?: StoreConfig<T, V> | InjectionToken<StoreConfig<T, V>> ): ModuleWithProviders<StoreFeatureModule>; <T, V extends Action<string> = Action<string>>( featureName: string, reducer: any, config?: any ): ModuleWithProviders<StoreFeatureModule>; <T, V extends Action<string> = Action<string>>( slice: FeatureSlice<T, V> ): ModuleWithProviders<StoreFeatureModule>;};
method forRoot
static forRoot: <T, V extends Action<string> = Action<string>>( reducers?: ActionReducerMap<T, V> | InjectionToken<ActionReducerMap<T, V>>, config?: RootStoreConfig<T, V>) => ModuleWithProviders<StoreRootModule>;
class StoreRootModule
class StoreRootModule {}
constructor
constructor( actions$: ActionsSubject, reducer$: ReducerObservable, scannedActions$: ScannedActionsSubject, store: Store<any>, guard: any, actionCheck: any);
property ɵfac
static ɵfac: i0.ɵɵFactoryDeclaration< StoreRootModule, [null, null, null, null, { optional: true }, { optional: true }]>;
property ɵinj
static ɵinj: i0.ɵɵInjectorDeclaration<StoreRootModule>;
property ɵmod
static ɵmod: i0.ɵɵNgModuleDeclaration<StoreRootModule, never, never, never>;
Interfaces
interface ActionCreatorProps
interface ActionCreatorProps<T> {}
interface ActionReducer
interface ActionReducer<T, V extends Action = Action> {}
A function that takes an
Action
and aState
, and returns aState
. SeecreateReducer
.
call signature
(state: T | undefined, action: V): T;
interface ActionReducerFactory
interface ActionReducerFactory<T, V extends Action = Action> {}
call signature
( reducerMap: ActionReducerMap<T, V>, initialState?: InitialState<T>): ActionReducer<T, V>;
interface FeatureConfig
interface FeatureConfig<FeatureName extends string, FeatureState> {}
interface FeatureSlice
interface FeatureSlice<T, V extends Action = Action> {}
An object with the name and the reducer for the feature.
interface MemoizedSelector
interface MemoizedSelector<State, Result, ProjectorFn = DefaultProjectorFn<Result>> extends Selector<State, Result> {}
property clearResult
clearResult: () => void;
property projector
projector: ProjectorFn;
property setResult
setResult: (result?: Result) => void;
method release
release: () => void;
interface MemoizedSelectorWithProps
interface MemoizedSelectorWithProps< State, Props, Result, ProjectorFn = DefaultProjectorFn<Result>> extends SelectorWithProps<State, Props, Result> {}
Deprecated
Selectors with props are deprecated, for more info see the
property clearResult
clearResult: () => void;
property projector
projector: ProjectorFn;
property setResult
setResult: (result?: Result) => void;
method release
release: () => void;
interface ReducerTypes
interface ReducerTypes<State, Creators extends readonly ActionCreator[]> {}
Return type of the
on
fn. Contains the action reducer coupled to one or more action types.
interface RootStoreConfig
interface RootStoreConfig<T, V extends Action = Action> extends StoreConfig<T, V> {}
property runtimeChecks
runtimeChecks?: Partial<RuntimeChecks>;
interface RuntimeChecks
interface RuntimeChecks {}
property strictActionImmutability
strictActionImmutability: boolean;
Verifies that actions aren't mutated
property strictActionSerializability
strictActionSerializability: boolean;
Verifies if the actions are serializable. Please note, you may not need to set it to
true
unless you are storing/replaying actions using external resources, for examplelocalStorage
.
property strictActionTypeUniqueness
strictActionTypeUniqueness?: boolean;
Verifies that action types are not registered more than once
property strictActionWithinNgZone
strictActionWithinNgZone: boolean;
Verifies that actions are dispatched within NgZone
property strictStateImmutability
strictStateImmutability: boolean;
Verifies that the state isn't mutated
property strictStateSerializability
strictStateSerializability: boolean;
Verifies if the state is serializable
interface StoreConfig
interface StoreConfig<T, V extends Action = Action> {}
property initialState
initialState?: InitialState<T>;
property metaReducers
metaReducers?: MetaReducer< { [P in keyof T]: T[P]; }, V>[];
property reducerFactory
reducerFactory?: ActionReducerFactory<T, V>;
Type Aliases
type ActionCreator
type ActionCreator<T extends string = string, C extends Creator = Creator> = C & Action<T>;
See
Creator
.
type ActionReducerMap
type ActionReducerMap<T, V extends Action = Action> = { [p in keyof T]: ActionReducer<T[p], V>;};
type ActionType
type ActionType<A> = A extends ActionCreator<infer T, infer C> ? ReturnType<C> & { type: T; } : never;
type Creator
type Creator< P extends any[] = any[], R extends object = object> = FunctionWithParametersType<P, R>;
A function that returns an object in the shape of the
Action
interface. Configured usingcreateAction
.
type DefaultProjectorFn
type DefaultProjectorFn<T> = (...args: any[]) => T;
type FunctionWithParametersType
type FunctionWithParametersType<P extends unknown[], R = void> = (...args: P) => R;
type MemoizedProjection
type MemoizedProjection = { memoized: AnyFn; reset: () => void; setResult: (result?: any) => void; clearResult: () => void;};
type MemoizeFn
type MemoizeFn = (t: AnyFn) => MemoizedProjection;
type MetaReducer
type MetaReducer<T = any, V extends Action = Action> = ( reducer: ActionReducer<T, V>) => ActionReducer<T, V>;
type NotAllowedCheck
type NotAllowedCheck<T extends object> = T extends any[] ? ArraysAreNotAllowed : T extends { type: any; } ? TypePropertyIsNotAllowed : keyof T extends never ? EmptyObjectsAreNotAllowed : unknown;
type Selector
type Selector<T, V> = (state: T) => V;
type SelectorWithProps
type SelectorWithProps<State, Props, Result> = ( state: State, props: Props) => Result;
Deprecated
Selectors with props are deprecated, for more info see
Package Files (18)
- index.d.ts
- src/action_creator.d.ts
- src/action_group_creator.d.ts
- src/actions_subject.d.ts
- src/feature_creator.d.ts
- src/flags.d.ts
- src/models.d.ts
- src/provide_store.d.ts
- src/reducer_creator.d.ts
- src/reducer_manager.d.ts
- src/scanned_actions_subject.d.ts
- src/selector.d.ts
- src/state.d.ts
- src/store.d.ts
- src/store_config.d.ts
- src/store_module.d.ts
- src/tokens.d.ts
- src/utils.d.ts
Dependencies (1)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (2)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@ngrx/store
.
- Markdown[](https://www.jsdocs.io/package/@ngrx/store)
- HTML<a href="https://www.jsdocs.io/package/@ngrx/store"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4394 ms. - Missing or incorrect documentation? Open an issue for this package.