Skip to content

Comments

chore(js-ts): migrate 12 Redux reducer files from JS to TS#326

Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1771498882-js-to-ts-reducers
Open

chore(js-ts): migrate 12 Redux reducer files from JS to TS#326
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1771498882-js-to-ts-reducers

Conversation

@devin-ai-integration
Copy link

@devin-ai-integration devin-ai-integration bot commented Feb 19, 2026

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, wizard

Each 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.tsx that referenced collectibles/index.js with an explicit .js extension — updated to an extensionless import so it resolves to the new .ts file.

Review & Testing Checklist for Human

  • Heavy any usage in swaps, transaction, collectibles, notification reducers. Multiple selectors use (state: any) instead of RootState, and TransactionState/TransactionData have [key: string]: any index signatures that effectively disable type checking. Evaluate whether tighter types are feasible or if these are acceptable for an initial migration pass.
  • Loosened action types for test compatibility. CollectiblesAction and SwapsAction use type: string | null with optional fields instead of discriminated unions. NotificationAction collapsed 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.
  • Non-null assertions (!) in collectibles reducer (lines ~121-123, ~147-149 of collectibles/index.ts). These assume selectedAddress, chainId, and collectible are present when the action type matches. A wrong dispatch would crash at runtime.
  • Behavioral change in collectibles selectors. Added 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 accessed undefined[chainId] and thrown).
  • Run the full test suite (yarn jest app/reducers/ and the CollectibleContracts tests) to verify behavioral equivalence. CI unit tests (all 10 shards) passed, but lint and lint:tsc were cancelled due to an unrelated audit:ci failure. Local lint:tsc confirms all type errors are pre-existing in unrelated files.

Notes

  • Pre-existing type errors in SwapsLiveness.ts, Asset/utils.ts, useRemainingTime.ts, and transaction-controller-init.ts are unrelated to this PR and remain unchanged.
  • The browser reducer uses action as AddToViewedDappAction cast because BrowserActionTypes.ADD_TO_VIEWED_DAPP comes from a JS file and TypeScript can't narrow the discriminated union through it.
  • CI failures (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

Co-Authored-By: Joao Esteves <joao.esteves@cognition.ai>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Co-Authored-By: Joao Esteves <joao.esteves@cognition.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants