From 6da255c2065316462ba92118f00fda8b8690fe20 Mon Sep 17 00:00:00 2001 From: Ken Date: Thu, 31 Jan 2019 11:28:14 -0800 Subject: [PATCH] no complete all --- playground/src/actions/index.ts | 1 - playground/src/components/TodoAppContainer.tsx | 1 - playground/src/reducers/createReducer.ts | 2 +- playground/src/reducers/index.ts | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/playground/src/actions/index.ts b/playground/src/actions/index.ts index 8d5da81..50b9d3e 100644 --- a/playground/src/actions/index.ts +++ b/playground/src/actions/index.ts @@ -13,7 +13,6 @@ export const actions = { remove: (id: string) => action('remove', { id }), edit: (id: string, label: string) => action('edit', { id, label }), complete: (id: string) => action('complete', { id }), - completeAll: () => action('completeAll'), clear: () => action('clear'), filter: (filterTypes: string) => action('filter', { filter: filterTypes }) }; diff --git a/playground/src/components/TodoAppContainer.tsx b/playground/src/components/TodoAppContainer.tsx index 837922a..3e8539f 100644 --- a/playground/src/components/TodoAppContainer.tsx +++ b/playground/src/components/TodoAppContainer.tsx @@ -16,7 +16,6 @@ export function mapDispatchToProps(dispatch: Dispatch) { add: (label: string) => dispatch(actions.add(label)), remove: (id: string) => dispatch(actions.remove(id)), complete: (id: string) => dispatch(actions.complete(id)), - completeAll: () => dispatch(actions.completeAll()), edit: (id: string, label: string) => dispatch(actions.edit(id, label)), clear: () => dispatch(actions.clear()), setFilter: (filter: FilterTypes) => dispatch(actions.filter(filter)) diff --git a/playground/src/reducers/createReducer.ts b/playground/src/reducers/createReducer.ts index 4bae7fe..f2bcb3e 100644 --- a/playground/src/reducers/createReducer.ts +++ b/playground/src/reducers/createReducer.ts @@ -2,7 +2,7 @@ import { Reducer } from 'redux'; import { ActionTypes, TodoAction, TodoActionLookup } from '../actions'; import { Draft, produce } from 'immer'; -export type ImmerReducer = (state: Draft, action: A) => T; +export type ImmerReducer = (state: Draft, action?: A) => T; export type HandlerMap = { [actionType in ActionTypes]?: ImmerReducer }; function isHandlerFunction(handlerOrMap: HandlerMap | ImmerReducer): handlerOrMap is ImmerReducer { diff --git a/playground/src/reducers/index.ts b/playground/src/reducers/index.ts index 0af3bd7..a04c2cc 100644 --- a/playground/src/reducers/index.ts +++ b/playground/src/reducers/index.ts @@ -24,7 +24,7 @@ export const reducer = combineReducers({ return draft; }, - clear(draft, action) { + clear(draft) { Object.keys(draft).forEach(id => { if (draft[id].completed) { delete draft[id];