chore(js-ts): migrate 12 Redux reducer files from JS to TS#326
Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Open
chore(js-ts): migrate 12 Redux reducer files from JS to TS#326devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Conversation
Co-Authored-By: Joao Esteves <joao.esteves@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Joao Esteves <joao.esteves@cognition.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
chore(js-ts): migrate 12 Redux reducer files from JS to TS
Summary
Converts 12 Redux reducer files from JavaScript to TypeScript as part of the ongoing JS-to-TS migration:
alert,bookmarks,browser,collectibles,infuraAvailability,modals,notification,privacy,settings,swaps,transaction,wizardEach file gets: state interfaces, action type definitions, typed reducer signatures, and typed selectors where applicable. No behavioral changes intended.
Also fixes a test import in
CollectibleContracts/index.test.tsxthat referencedcollectibles/index.jswith an explicit.jsextension — updated to an extensionless import so it resolves to the new.tsfile.Review & Testing Checklist for Human
anyusage in swaps, transaction, collectibles, notification reducers. Multiple selectors use(state: any)instead ofRootState, andTransactionState/TransactionDatahave[key: string]: anyindex signatures that effectively disable type checking. Evaluate whether tighter types are feasible or if these are acceptable for an initial migration pass.CollectiblesActionandSwapsActionusetype: string | nullwith optional fields instead of discriminated unions.NotificationActioncollapsed 10 distinct interfaces into one flat interface. This means dispatching incorrect action payloads won't be caught at compile time. Verify this tradeoff is acceptable vs. updating the test files.!) in collectibles reducer (lines ~121-123, ~147-149 ofcollectibles/index.ts). These assumeselectedAddress,chainId, andcollectibleare present when the action type matches. A wrong dispatch would crash at runtime.if (!address) return []/return {}guards that didn't exist in the original JS. Confirm these early returns are safe and don't change observable behavior (the JS version would have accessedundefined[chainId]and thrown).yarn jest app/reducers/and the CollectibleContracts tests) to verify behavioral equivalence. CI unit tests (all 10 shards) passed, butlintandlint:tscwere cancelled due to an unrelatedaudit:cifailure. Locallint:tscconfirms all type errors are pre-existing in unrelated files.Notes
SwapsLiveness.ts,Asset/utils.ts,useRemainingTime.ts, andtransaction-controller-init.tsare unrelated to this PR and remain unchanged.browserreducer usesaction as AddToViewedDappActioncast becauseBrowserActionTypes.ADD_TO_VIEWED_DAPPcomes from a JS file and TypeScript can't narrow the discriminated union through it.check-diff,check-pr-labels,CLABot,audit:ci) are all infrastructure/admin checks unrelated to the code changes.Link to Devin run: https://app.devin.ai/sessions/502e038e146e494b85aa6dbb6670db39
Requested by: @joao-cognition