ReducerActions<T>: { [ K in keyof T]: ActionCreator<Args<T[K]>[1]> }

The ReducerActions type defines a type that helps to generate auto-complete for reducer action functions. It is used as a property of a reducer class that extends AbstractReducer.

The type is a mapped type that iterates through each key of the generic type T and creates a property with that same key. The value of each property is a function type called ActionPayload, which takes an optional payload and returns an AnyAction. The payload type is inferred from the second argument of the function type at that key in T.

Example

export class MyReducer extends AbstractReducer {
static actions: ReducerActions<MyReducer> = {
someReducerFunction: (payload) => ({
type: 'SOME_ACTION',
payload,
}),
};

someReducerFunction(param1: string, param2: number): void {
// Some reducer logic here
}
}

Type Parameters

  • T

Generated using TypeDoc