Skip to content

Commit df9ece4

Browse files
committed
avoid as any
1 parent 84bb039 commit df9ece4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/toolkit/src/createSlice.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -761,14 +761,14 @@ export function buildCreateSlice({ creators }: BuildCreateSliceConfig = {}) {
761761
return _reducer.getInitialState()
762762
}
763763

764-
function makeSelectorProps(
765-
reducerPath: ReducerPath,
764+
function makeSelectorProps<CurrentReducerPath extends string = ReducerPath>(
765+
reducerPath: CurrentReducerPath,
766766
injected = false
767767
): Pick<
768-
Slice<State, CaseReducers, Name, ReducerPath, Selectors>,
768+
Slice<State, CaseReducers, Name, CurrentReducerPath, Selectors>,
769769
'getSelectors' | 'selectors' | 'selectSlice' | 'reducerPath'
770770
> {
771-
function selectSlice(state: { [K in ReducerPath]: State }) {
771+
function selectSlice(state: { [K in CurrentReducerPath]: State }) {
772772
let sliceState = state[reducerPath]
773773
if (typeof sliceState === 'undefined') {
774774
if (injected) {
@@ -827,7 +827,7 @@ export function buildCreateSlice({ creators }: BuildCreateSliceConfig = {}) {
827827
injectable.inject({ reducerPath: newReducerPath, reducer }, config)
828828
return {
829829
...slice,
830-
...makeSelectorProps(newReducerPath as any, true),
830+
...makeSelectorProps(newReducerPath, true),
831831
} as any
832832
},
833833
}

0 commit comments

Comments
 (0)