Skip to content

Comments

chore(js-ts): Add TypeScript interfaces for Redux reducers in RootState#306

Open
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin/1770241859-type-redux-reducers
Open

chore(js-ts): Add TypeScript interfaces for Redux reducers in RootState#306
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin/1770241859-type-redux-reducers

Conversation

@devin-ai-integration
Copy link

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

chore(js-ts): Add TypeScript interfaces for Redux reducers in RootState

Summary

Converts 12 JavaScript reducer files to TypeScript and adds proper type interfaces for all 18 reducers that were previously typed as any in the RootState interface.

Converted reducers (JS → TS):

  • alert, bookmarks, browser, collectibles, infuraAvailability, modals, notification, privacy, settings, swaps, transaction, wizard

Updated existing TypeScript reducers with exported state types:

  • experimentalSettings, legalNotices, networkSelector (networkOnboarded), signatureRequest

Each reducer now exports a properly typed state interface that replaces any in the RootState interface.

Updates since last revision

  • Fixed selectSwapsChainFeatureFlags selector to restore original throwing behavior when no chain entry exists (was causing unit test failure)
  • Fixed test file import path in CollectibleContracts/index.test.tsx (removed explicit .js extension after file conversion)

Review & Testing Checklist for Human

  • BrowserTab.id type change: Changed from number to string. The reducer now converts IDs via String(action.id). Verify this doesn't break browser tab functionality since Date.now() returns a number in the action creators.

  • selectSwapsChainFeatureFlags throwing behavior: Selector now throws when accessing a chain that doesn't exist in state (e.g., swapsState[chainId].featureFlags). This matches original JS behavior but verify swap flows handle this correctly.

  • TypeScript error count increased: Original codebase had 51 TS errors, this PR increases to 117. Most new errors are in test files creating partial mock state objects. Verify this is acceptable for the migration strategy.

  • security-alerts.ts selector change: Return type changed from { securityAlertResponse: SecurityAlertResponse } to SignatureRequestState (where securityAlertResponse is optional). Verify consumers handle the optional property.

  • Collectibles selectors: Added null checks for address parameter. Verify this doesn't change expected behavior.

Recommended test plan:

  1. Run the app and test browser tab creation/switching
  2. Test NFT favorites functionality
  3. Test swap flow to verify feature flags work correctly
  4. Run existing unit tests to identify any failures from type changes

Notes

  • Pre-existing TypeScript errors in transaction reducer (TxMeta type compatibility) were not addressed as they existed before this change
  • Test file type errors are expected and should be addressed in follow-up PRs
  • This is part of the JS → TS migration effort
  • Some CI checks (check-diff, check-pr-labels, CLABot, audit:ci) fail due to infrastructure/permissions issues, not code problems. All unit tests pass.

Link to Devin run: https://app.devin.ai/sessions/3c6301a7416f462abfd4340ec8aab143
Requested by: Shannon Hittson (@shannonhittson-eng)


Open with Devin

Convert 12 JavaScript reducer files to TypeScript and add proper type
interfaces for all 18 reducers that were previously typed as 'any' in
the RootState interface.

Converted reducers (JS to TS):
- alert
- bookmarks
- browser
- collectibles
- infuraAvailability
- modals
- notification
- privacy
- settings
- swaps
- transaction
- wizard

Updated existing TypeScript reducers with exported state types:
- experimentalSettings
- legalNotices
- networkSelector (networkOnboarded)
- signatureRequest
- rpcEvents (already typed)
- accounts (already typed)

Each reducer now exports a properly typed state interface that is used
in the RootState interface instead of 'any'.

Co-Authored-By: Shannon Hittson <shannon.hittson@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

devin-ai-integration bot and others added 2 commits February 4, 2026 22:27
Remove explicit .js extension from import path to work with the
renamed .ts file.

Co-Authored-By: Shannon Hittson <shannon.hittson@cognition.ai>
Co-Authored-By: Shannon Hittson <shannon.hittson@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