This is a:
Which concerns:
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
This is a:
Which concerns:
What is the current behaviour?
This code throws exception that TAction and TState is not defined in line
If change this codeline to
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