-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
This is a:
- Bug Report
- Feature Request
- Question
- Other
Which concerns:
- flow-runtime
- babel-plugin-flow-runtime
- flow-runtime-validators
- flow-runtime-mobx
- flow-config-parser
- The documentation website
What is the current behaviour?
type ActionTypes = { ... };
type THandlers<TState, TAction: ActionTypes> = {
[key: string]: (state: TState, action: TAction) => TState
};
type TReducer<TState, TAction: ActionTypes> = (state: TState, action: TAction) => TState;
export default function createReducer<TState, TAction: ActionTypes>(
initialState: TState,
handlers: THandlers<TState, TAction>,
): TReducer<TState, TAction> {
return function reducer(state: TState = initialState, action: TAction): TState {
if (handlers[action.type]) {
return handlers[action.type](state, action);
}
return state;
};
}
This code throws exception that TAction and TState is not defined in line
return function reducer(state: TState = initialState, action: TAction): TState {
If change this codeline to
return function reducer(state: * = initialState, action: *): * {
then exception is missing and code works.
What is the expected behaviour?
Should work correctly.
Works fine without flow-runtime.
Which package versions are you using?
flow-runtime version: 0.17.0
babel-plugin-flow-runtime version: 0.18.0
Metadata
Metadata
Assignees
Labels
No labels