mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
reduced typings some more
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { ActionTypes, TodoActionLookup } from '../actions';
|
||||
import { ActionTypes, TodoActionLookup, actions } from '../actions';
|
||||
import { createGenericReducer, HandlerMap, ImmerReducer } from '../redux-utils/reducer';
|
||||
import { Reducer } from 'redux';
|
||||
|
||||
export function createReducer<T, AT extends ActionTypes | never = never>(
|
||||
export function createReducer<T, AM extends ActionTypes | never = never>(
|
||||
initialState: T,
|
||||
handlerOrMap: HandlerMap<T, ActionTypes, TodoActionLookup> | ImmerReducer<T, TodoActionLookup[AT]>
|
||||
) {
|
||||
return createGenericReducer(initialState, handlerOrMap);
|
||||
handlerOrMap: HandlerMap<T, typeof actions> | ImmerReducer<T, TodoActionLookup[AM]>
|
||||
): Reducer<T> {
|
||||
return createGenericReducer<T, typeof actions, AM>(initialState, handlerOrMap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user