Skip to content

Commit

Permalink
Change base Typescript example to include AppStore type
Browse files Browse the repository at this point in the history
  • Loading branch information
EskiMojo14 committed May 10, 2024
1 parent 5cac910 commit d75a39b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/usage/UsageWithTypescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof store.getState>
export type RootState = ReturnType<AppStore['getState']>
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch
export type AppDispatch = AppStore['dispatch']
// highlight-end
```
Expand Down

0 comments on commit d75a39b

Please sign in to comment.