Skip to content

Commit 01feaae

Browse files
committed
use CreatorCaseReducers type in more places
1 parent c0ba6ab commit 01feaae

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

packages/toolkit/src/createSlice.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,7 @@ interface InjectIntoConfig<NewReducerPath extends string> extends InjectConfig {
352352
*/
353353
export interface Slice<
354354
State = any,
355-
CaseReducers extends
356-
| SliceCaseReducers<State>
357-
| Record<string, ReducerDefinition> = SliceCaseReducers<State>,
355+
CaseReducers extends CreatorCaseReducers<State> = SliceCaseReducers<State>,
358356
Name extends string = string,
359357
ReducerPath extends string = Name,
360358
Selectors extends SliceSelectors<State> = SliceSelectors<State>,
@@ -442,9 +440,7 @@ export interface Slice<
442440
*/
443441
interface InjectedSlice<
444442
State = any,
445-
CaseReducers extends
446-
| SliceCaseReducers<State>
447-
| Record<string, ReducerDefinition> = SliceCaseReducers<State>,
443+
CaseReducers extends CreatorCaseReducers<State> = SliceCaseReducers<State>,
448444
Name extends string = string,
449445
ReducerPath extends string = Name,
450446
Selectors extends SliceSelectors<State> = SliceSelectors<State>,
@@ -746,9 +742,7 @@ export type SliceActionType<
746742
* @public
747743
*/
748744
export type CaseReducerActions<
749-
CaseReducers extends
750-
| SliceCaseReducers<any>
751-
| Record<string, ReducerDefinition>,
745+
CaseReducers extends CreatorCaseReducers<State>,
752746
SliceName extends string,
753747
State = any,
754748
> = Id<
@@ -792,9 +786,7 @@ type ActionCreatorForCaseReducer<CR, Type extends string> = CR extends (
792786
* @internal
793787
*/
794788
type SliceDefinedCaseReducers<
795-
CaseReducers extends
796-
| SliceCaseReducers<any>
797-
| Record<string, ReducerDefinition>,
789+
CaseReducers extends CreatorCaseReducers<State>,
798790
SliceName extends string = string,
799791
State = any,
800792
> = Id<

0 commit comments

Comments
 (0)