Skip to content

Commit ef57856

Browse files
authored
Change base Typescript example to include AppStore type (#4704)
1 parent 5cac910 commit ef57856

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/usage/UsageWithTypescript.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ export const store = configureStore({
6565
})
6666

6767
// highlight-start
68+
// Get the type of our store variable
69+
export type AppStore = typeof store
6870
// Infer the `RootState` and `AppDispatch` types from the store itself
69-
export type RootState = ReturnType<typeof store.getState>
71+
export type RootState = ReturnType<AppStore['getState']>
7072
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
71-
export type AppDispatch = typeof store.dispatch
73+
export type AppDispatch = AppStore['dispatch']
7274
// highlight-end
7375
```
7476

0 commit comments

Comments
 (0)