UNPKG

ngrx-run

Version:

Return side-effects as data from your NgRx reducers

23 lines (22 loc) 1.31 kB
import { Action, ActionCreator } from '@ngrx/store'; import { ReducerResult } from './reducer'; export declare type ActionsOf<T extends { [key: string]: (...args: any) => any; }> = ReturnType<T[keyof T]>; export declare function isActionOf<T extends { [key: string]: ActionCreator; }>(action: Action, actions: T): action is ActionsOf<T> & Action; export declare function childReducer<S, K extends keyof S, A extends Action>(state: S, key: K, action: A, reducer: InitializedActionReducer<S[K], A>): S; declare type InitializedActionReducer<T, A> = (state: T, action: A) => ReducerResult<T>; export declare function tokenized<T, K extends string, P extends object>(actionCreator: ActionCreator<K, (props: P) => P & TypedAction<K>>, token: Token<P>): ActionCreator<K, (props: P) => P & TypedAction<K>> & Tokenized<T, P, K>; export declare function hasToken<P>(maybeTokenized: Action, token: Token<P>): maybeTokenized is Action & P; export declare function createToken<U>(token: string): Token<U>; declare type Token<U> = string & U; declare type Tokenized<T, P, K extends string> = { token: T; } & PropsFn<P, K>; declare type PropsFn<P, K extends string> = (props: P) => P & TypedAction<K>; interface TypedAction<T extends string> extends Action { readonly type: T; } export {};