File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ export type ActionMatcherDescriptionCollection<S> = Array<
5555export type CaseReducer < S = any , A extends Action = AnyAction > = (
5656 state : Draft < S > ,
5757 action : A
58- ) => S | void | Draft < S >
58+ ) => NoInfer < S > | void | Draft < NoInfer < S > >
5959
6060/**
6161 * A mapping from action types to case reducers for `createReducer()`.
Original file line number Diff line number Diff line change @@ -59,21 +59,22 @@ const value = actionCreators.anyKey
5959 increment : ( state : number , action ) => state + action . payload ,
6060 decrement : ( state : number , action ) => state - action . payload ,
6161 } ,
62- extraReducers : {
63- [ firstAction . type ] : ( state : number , action ) =>
64- state + action . payload . count ,
62+ extraReducers : ( builder ) => {
63+ builder . addCase (
64+ firstAction ,
65+ ( state , action ) => state + action . payload . count
66+ )
6567 } ,
6668 } )
6769
6870 /* Reducer */
6971
70- const reducer : Reducer < number , PayloadAction > = slice . reducer
72+ expectType < Reducer < number , PayloadAction > > ( slice . reducer )
7173
7274 // @ts -expect-error
73- const stringReducer : Reducer < string , PayloadAction > = slice . reducer
75+ expectType < Reducer < string , PayloadAction > > ( slice . reducer )
7476 // @ts -expect-error
75- const anyActionReducer : Reducer < string , AnyAction > = slice . reducer
76-
77+ expectType < Reducer < string , AnyAction > > ( slice . reducer )
7778 /* Actions */
7879
7980 slice . actions . increment ( 1 )
You can’t perform that action at this time.
0 commit comments