@@ -761,14 +761,14 @@ export function buildCreateSlice({ creators }: BuildCreateSliceConfig = {}) {
761
761
return _reducer . getInitialState ( )
762
762
}
763
763
764
- function makeSelectorProps (
765
- reducerPath : ReducerPath ,
764
+ function makeSelectorProps < CurrentReducerPath extends string = ReducerPath > (
765
+ reducerPath : CurrentReducerPath ,
766
766
injected = false
767
767
) : Pick <
768
- Slice < State , CaseReducers , Name , ReducerPath , Selectors > ,
768
+ Slice < State , CaseReducers , Name , CurrentReducerPath , Selectors > ,
769
769
'getSelectors' | 'selectors' | 'selectSlice' | 'reducerPath'
770
770
> {
771
- function selectSlice ( state : { [ K in ReducerPath ] : State } ) {
771
+ function selectSlice ( state : { [ K in CurrentReducerPath ] : State } ) {
772
772
let sliceState = state [ reducerPath ]
773
773
if ( typeof sliceState === 'undefined' ) {
774
774
if ( injected ) {
@@ -827,7 +827,7 @@ export function buildCreateSlice({ creators }: BuildCreateSliceConfig = {}) {
827
827
injectable . inject ( { reducerPath : newReducerPath , reducer } , config )
828
828
return {
829
829
...slice ,
830
- ...makeSelectorProps ( newReducerPath as any , true ) ,
830
+ ...makeSelectorProps ( newReducerPath , true ) ,
831
831
} as any
832
832
} ,
833
833
}
0 commit comments