File tree 2 files changed +9
-8
lines changed
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<
55
55
export type CaseReducer < S = any , A extends Action = AnyAction > = (
56
56
state : Draft < S > ,
57
57
action : A
58
- ) => S | void | Draft < S >
58
+ ) => NoInfer < S > | void | Draft < NoInfer < S > >
59
59
60
60
/**
61
61
* 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
59
59
increment : ( state : number , action ) => state + action . payload ,
60
60
decrement : ( state : number , action ) => state - action . payload ,
61
61
} ,
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
+ )
65
67
} ,
66
68
} )
67
69
68
70
/* Reducer */
69
71
70
- const reducer : Reducer < number , PayloadAction > = slice . reducer
72
+ expectType < Reducer < number , PayloadAction > > ( slice . reducer )
71
73
72
74
// @ts -expect-error
73
- const stringReducer : Reducer < string , PayloadAction > = slice . reducer
75
+ expectType < Reducer < string , PayloadAction > > ( slice . reducer )
74
76
// @ts -expect-error
75
- const anyActionReducer : Reducer < string , AnyAction > = slice . reducer
76
-
77
+ expectType < Reducer < string , AnyAction > > ( slice . reducer )
77
78
/* Actions */
78
79
79
80
slice . actions . increment ( 1 )
You can’t perform that action at this time.
0 commit comments