-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CHORE] Provide types for react-redux hooks #3354
Conversation
If anyone feels like a good cleanup here's a regex (thanks copilot) that (maybe) will replace all our useDispatch hooks to use the new one... Search: Replace: |
Quality Gate passed for 'bcgov-sonarcloud_mds_minespace-web'Issues Measures |
Quality Gate failed for 'bcgov-sonarcloud_mds_common'Failed conditions See analysis details on SonarQube Cloud Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE |
Quality Gate passed for 'bcgov-sonarcloud_mds_core-web'Issues Measures |
type AppAction = UnknownAction | FormAction; | ||
|
||
// Infer the `RootState` and `AppDispatch` types from the store itself + make sure redux-form acti are captured as well. | ||
export type AppDispatch = typeof store.dispatch & Dispatch<AppAction>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sonarcloud doesn't like this &
operator. Unfortunately needed as AppAction
is coming from redux-form
and couldn't find a way of avoiding it without providing our own redux-form
typing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
Objective
CHORE
This PR adds typed versions of common react-redux hooks as per https://react-redux.js.org/using-react-redux/usage-with-typescript.
Using those hooks will have the types defined in your action creators propagate or if those are untyped, will be
any
redux-form actions is supported in addition to our actions
Before:
After: