TypeScript for Reduxs
Typing Redux with TypeScript means giving the store, state, dispatch and slice actions precise types so mistakes are caught at compile time. Standard practice is to infer RootState and AppDispatch from the store, then create typed hooks such as useAppSelector and useAppDispatch, and to type action payloads with PayloadAction.
Stage: Patterns · Part of the Redux roadmap · Last reviewed 19 November 2026
What to learn in TypeScript
- Infer RootState and AppDispatch from the configured store
- Create typed useAppSelector and useAppDispatch hooks
- Type action payloads using PayloadAction
- Type the arguments and return value of createAsyncThunk
- Use generated RTK Query hooks with typed responses
TypeScript interview questions
Why create typed hooks instead of using useSelector directly?
A plain useSelector does not know your state shape, so state is untyped inside the callback. A typed hook is bound to RootState, giving autocomplete and compile-time checks everywhere, and it avoids repeating type annotations in each component.
How do you type the initial state of a slice?
Declare an interface for the slice state and annotate the initialState constant with it, for example const initialState: CounterState = { value: 0 }. createSlice then infers the reducer state type and the generated action creators from it.
Where TypeScript fits in the Redux roadmap
TypeScript belongs to the Patterns stage (intermediate level). Scale it.
Other units in this stage
Back to the full Redux roadmap