Members
(static) isWithTypeField
Infer return type if T
is function, return T
itself otherwise.
(inner, constant) payload
Unique, private identifier distinguishing between EmptyAction and PayloadAction (statically and in runtime).
Methods
(inner) actionCreators(actionEnum, payloadCreators)
Construct action slice for provided action enum. Optionally define action creators with payload. Statically typed.
Parameters:
Name | Type | Description |
---|---|---|
actionEnum |
Enum upon which an ActionCreators object is built. |
|
payloadCreators |
Optional object with payload creators. |
Returns:
ActionCreators object.
(inner) bindActionCreator(actionCreatorOrThunk, dispatch)
Binds given action creator or thunk with chosen store's dispatch.
Parameters:
Name | Type | Description |
---|---|---|
actionCreatorOrThunk |
any action creator or thunk |
|
dispatch |
redux store's |
Returns:
bound action creator or thunk dispatch
(inner) bindActionCreators(actionCreators, dispatch)
Redux's original bindActionCreators
clone with extended Action
support (original function assumes dispatch parametrized with redux's
UnknownAction
which is not compatible with Action
).
Turns an object with action creators or thunks into an object with every
action creator wrapped into a dispatch
call.
Parameters:
Name | Type | Description |
---|---|---|
actionCreators |
Object with action creator functions |
|
dispatch |
redux store's |
Returns:
Object with wrapped action creators
(inner) bindActionCreatorsTree(acTree, dispatch)
Bind whole tree of action creators to the redux's dispatch function.
Parameters:
Name | Type | Description |
---|---|---|
acTree |
Object with |
|
dispatch |
redux store's |
Returns:
Object with wrapped action creators
(inner) createReducer(initState) → {ReduxBoundReducer}
Create clean and readable reducers for redux.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
initState |
Returns:
- Type:
-
ReduxBoundReducer
(inner) defineActionCreator(actionType, creator)
Redux action creator definer.
Parameters:
Name | Type | Description |
---|---|---|
actionType |
Action type |
|
creator |
Optional custom function returning payload. |
Returns:
Action creator function.
(inner) emptyActionCreators(actionEnum)
Construct object whose keys correspond to actionEnum
keys and
values consists of empty action creators for each type. Conforms to
EmptyActionCreators<ActionEnum>
interface.
Parameters:
Name | Type | Description |
---|---|---|
actionEnum |
Enum upon which an EmptyActionCreators object is built. |
Returns:
EmptyActionCreators object.
(inner) isACWithPayload()
Type predicate - not exposed red-g's internal.
(inner) isWithPayload()
Type predicate - does a given action carry payload?
(inner) isWithTypeField()
Checks for type
field presence in a given candidate.
(inner) payloadActionCreators(emptyActionCreators, payloadCreators)
Take empty action creators object based on ActionEnum
type
(an object with all action creators not carrying anything besides
type
property) and PayloadCreators
object consisting of plain
javascript functions taking arguments and returning values.
PayloadCreators
object type is constrained to be a subset of ActionEnum
type (in the sense of AllowSubset
type defined in type/utils.ts
).
Create fully typed action creators object with all action creators
defined as EmptyActionCreator
or PayloadActionCreator
.
Parameters:
Name | Type | Description |
---|---|---|
emptyActionCreators |
EmptyActionCreators object |
|
payloadCreators |
Object with payload creators. |
Returns:
ActionCreators object.
(inner) sliceReducer(initState)
Statically typed reducer for a slice of state.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
initState |
Returns:
(builder: (slice: SliceBuildAPI) => void) => ReduxCompatReducer