Skip to content
Discussion options

You must be logged in to vote

for slices you know will be mounted under their name/reducerPath, we export a WithSlice helper:

const counterSlice = createSlice({
  name: "counter",
  initialState: { value: 0 },
  reducers: {}
})
type CounterState = WithSlice<typeof counterSlice> // { counter: { value: 0 } }

For other locations you'd have to be a bit more manual:

interface PartialRootState {
  features: {
    counter: ReturnType<typeof counterSlice.getInitialState>
  }
}

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
9 replies
@michalvadak
Comment options

@EskiMojo14
Comment options

Answer selected by michalvadak
@michalvadak
Comment options

@markerikson
Comment options

@michalvadak
Comment options

@markerikson
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants