@@ -507,8 +507,15 @@ type CreatorCallback<
507
507
) => Record < string , ReducerDefinition >
508
508
509
509
type GetCaseReducers <
510
- CR extends SliceCaseReducers < any > | CreatorCallback < any , any , any , any > ,
511
- > = CR extends CreatorCallback < any , any , any , any > ? ReturnType < CR > : CR
510
+ State ,
511
+ Name extends string ,
512
+ ReducerPath extends string ,
513
+ CreatorMap extends Record < string , RegisteredReducerType > ,
514
+ CR extends SliceCaseReducers < State > | CreatorCallback < State , any , any , any > ,
515
+ > =
516
+ CR extends CreatorCallback < State , Name , ReducerPath , CreatorMap >
517
+ ? ReturnType < CR >
518
+ : CR
512
519
513
520
/**
514
521
* Options for `createSlice()`.
@@ -907,7 +914,13 @@ export function buildCreateSlice<
907
914
Selectors ,
908
915
CreatorMap
909
916
> ,
910
- ) : Slice < State , GetCaseReducers < CaseReducers > , Name , ReducerPath , Selectors > {
917
+ ) : Slice <
918
+ State ,
919
+ GetCaseReducers < State , Name , ReducerPath , CreatorMap , CaseReducers > ,
920
+ Name ,
921
+ ReducerPath ,
922
+ Selectors
923
+ > {
911
924
const { name, reducerPath = name as unknown as ReducerPath } = options
912
925
if ( ! name ) {
913
926
throw new Error ( '`name` is a required option for createSlice' )
@@ -1104,7 +1117,7 @@ export function buildCreateSlice<
1104
1117
) : Pick <
1105
1118
Slice <
1106
1119
State ,
1107
- GetCaseReducers < CaseReducers > ,
1120
+ GetCaseReducers < State , Name , ReducerPath , CreatorMap , CaseReducers > ,
1108
1121
Name ,
1109
1122
CurrentReducerPath ,
1110
1123
Selectors
@@ -1160,7 +1173,7 @@ export function buildCreateSlice<
1160
1173
1161
1174
const slice : Slice <
1162
1175
State ,
1163
- GetCaseReducers < CaseReducers > ,
1176
+ GetCaseReducers < State , Name , ReducerPath , CreatorMap , CaseReducers > ,
1164
1177
Name ,
1165
1178
ReducerPath ,
1166
1179
Selectors
0 commit comments