-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
refactor: Migrate store to TypeScript #7110
Conversation
a12d254
to
7d3a46d
Compare
7d3a46d
to
481dce1
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #7110 +/- ##
==========================================
- Coverage 32.86% 32.85% -0.01%
==========================================
Files 1001 1001
Lines 26757 26756 -1
Branches 2109 2113 +4
==========================================
- Hits 8794 8792 -2
Misses 17540 17540
- Partials 423 424 +1
☔ View full report in Codecov by Sentry. |
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.
LGTM
The Redux store module and the root reducer have been migrated to TypeScript. We now have the start of a root state object for the Redux state. Most of the reducers still aren't typed, or there are type errors, but it's a start. The missing pieces are typed as `any` for now. The TypeScript conversion introduced some lint errors caused by the pattern of using destructuring to omit object properties. The rule has been updated to allow this pattern (it's already allowed on the latest shared ESLint config). The store type changes required updates to the selectors as well. The types they had been using only included a subset of the root state. They have been updated to use the real root state type instead. This relates to MetaMask/mobile-planning#1226
481dce1
to
300ca07
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs 44.4% Coverage The version of Java (11.0.20) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17. |
// Source: https://redux.js.org/tutorials/typescript-quick-start | ||
// Infer the `RootState` and `AppDispatch` types from the store itself | ||
// @ts-expect-error Type errors in store | ||
export type RootState = ReturnType<typeof store.getState>; |
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.
This broke this import:
import { RootState } from '../../../../reducers/fiatOrders/types'; |
Fix is to change
import { RootState } from '../../../../reducers/fiatOrders/types';
to
import { RootState } from '../../../../reducers';
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.
Thanks! I will fix this
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.
Fixed here: #7147
Development & PR Process
release-xx
label to identify the PR slated for a upcoming release (will be used in release discussion)needs-dev-review
label when work is completedneeds-qa
: PR requires manual QA.No QA/E2E only
: PR does not require any manual QA effort. Prior to merging, ensure that you have successful end-to-end test runs in Bitrise.Spot check on release build
: PR does not require feature QA but needs non-automated verification. In the description section, provide test scenarios. Add screenshots, and or recordings of what was tested.QA Passed
label when QA has signed off (Only required if the PR was labeled withneeds-qa
)team-
(orexternal-contributor
label if your not a MetaMask employee)Description
The Redux store module and the root reducer have been migrated to TypeScript. We now have the start of a root state object for the Redux state. Most of the reducers still aren't typed, or there are type errors, but it's a start. The missing pieces are typed as
any
for now.The TypeScript conversion introduced some lint errors caused by the pattern of using destructuring to omit object properties. The rule has been updated to allow this pattern (it's already allowed on the latest shared ESLint config).
The store type changes required updates to the selectors as well. The types they had been using only included a subset of the root state. They have been updated to use the real root state type instead.
Issue
This relates to https://github.com/MetaMask/mobile-planning/issues/1226
Checklist