From ef57856c0d16f0c99fce75d9252be60d1c72e15b Mon Sep 17 00:00:00 2001 From: Ben Durrant Date: Fri, 10 May 2024 16:56:56 +0100 Subject: [PATCH] Change base Typescript example to include AppStore type (#4704) --- docs/usage/UsageWithTypescript.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/usage/UsageWithTypescript.md b/docs/usage/UsageWithTypescript.md index 087bf0cc41..93cf460081 100644 --- a/docs/usage/UsageWithTypescript.md +++ b/docs/usage/UsageWithTypescript.md @@ -65,10 +65,12 @@ export const store = configureStore({ }) // highlight-start +// Get the type of our store variable +export type AppStore = typeof store // Infer the `RootState` and `AppDispatch` types from the store itself -export type RootState = ReturnType +export type RootState = ReturnType // Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState} -export type AppDispatch = typeof store.dispatch +export type AppDispatch = AppStore['dispatch'] // highlight-end ```