Skip to content

Commit c0ba6ab

Browse files
committed
pass name and state to SliceReducerCreators when getting final actions/case reducers type
1 parent 97fa0bd commit c0ba6ab

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/toolkit/src/createSlice.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,13 +378,13 @@ export interface Slice<
378378
* Action creators for the types of actions that are handled by the slice
379379
* reducer.
380380
*/
381-
actions: CaseReducerActions<CaseReducers, Name>
381+
actions: CaseReducerActions<CaseReducers, Name, State>
382382

383383
/**
384384
* The individual case reducer functions that were passed in the `reducers` parameter.
385385
* This enables reuse and testing if they were defined inline when calling `createSlice`.
386386
*/
387-
caseReducers: SliceDefinedCaseReducers<CaseReducers, Name>
387+
caseReducers: SliceDefinedCaseReducers<CaseReducers, Name, State>
388388

389389
/**
390390
* Provides access to the initial state value given to the slice.
@@ -750,10 +750,11 @@ export type CaseReducerActions<
750750
| SliceCaseReducers<any>
751751
| Record<string, ReducerDefinition>,
752752
SliceName extends string,
753+
State = any,
753754
> = Id<
754755
UnionToIntersection<
755756
SliceReducerCreators<
756-
any,
757+
State,
757758
CaseReducers,
758759
SliceName
759760
>[RegisteredReducerType]['actions']
@@ -795,10 +796,11 @@ type SliceDefinedCaseReducers<
795796
| SliceCaseReducers<any>
796797
| Record<string, ReducerDefinition>,
797798
SliceName extends string = string,
799+
State = any,
798800
> = Id<
799801
UnionToIntersection<
800802
SliceReducerCreators<
801-
any,
803+
State,
802804
CaseReducers,
803805
SliceName
804806
>[RegisteredReducerType]['caseReducers']

0 commit comments

Comments
 (0)