Skip to content

chore: create root params list type#25544

Merged
asalsys merged 44 commits intomainfrom
chore/root-params-list-type
Feb 17, 2026
Merged

chore: create root params list type#25544
asalsys merged 44 commits intomainfrom
chore/root-params-list-type

Conversation

@asalsys
Copy link
Contributor

@asalsys asalsys commented Feb 2, 2026

Description

This PR introduces a comprehensive TypeScript type definition file (Params.ts) for navigation parameters in the MetaMask Mobile app.

Reason for the change:
Navigation in React Native apps using React Navigation benefits greatly from strong typing. Currently, route parameters are loosely typed, which can lead to runtime errors when passing incorrect or missing parameters between screens.

Improvement/Solution:

  • Created app/constants/navigation/Params.ts with ~1,267 lines of type definitions
  • Defines RouteParams interface that mirrors the structure of Routes.ts
  • Provides 80+ individual parameter interfaces for specific routes (e.g., BrowserParams, StakeParams, BridgeParams)
  • Includes utility types like GetRouteParams<T> for easy type extraction
  • Exports RootStackParamList for React Navigation compatibility
  • Covers all major navigation flows: Ramp, Deposit, Bridge, Perps, Predict, Staking, Earn, Card, Notifications, and more

Changelog

CHANGELOG entry: null

Related issues

Fixes: #23762

Manual testing steps

Feature: Navigation parameter types

Scenario: Developer uses typed navigation parameters
Given the developer imports types from app/constants/navigation/Params.ts

When the developer navigates to a typed route
Then TypeScript provides autocomplete for valid parameters
And TypeScript shows errors for invalid or missing required parameters## **Screenshots/Recordings**

Before

N/A - This is a new type definition file (no visual changes)

After

N/A - This is a TypeScript type file only, no runtime or visual changes

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Type-only refactor that centralizes navigation parameter definitions; risk is limited to potential TS build/type regressions or mismatched param shapes where routes are wired.

Overview
Adds a new app/core/NavigationService/types.ts that defines a flattened RootStackParamList and globally registers it with React Navigation for type-safe navigate/route params across the app.

Extracts and centralizes many route param interfaces into dedicated *.types.ts files (Bridge, Ramp, Earn, Stake, Card, Send, Modals, Multichain, etc.), and updates existing screens to export their param types (e.g., Ramp BuildQuoteParams, OrderDetailsParams, Deposit KycWebviewModalParams) and re-export webview params for compatibility. Also refactors Predict navigation to use named param interfaces instead of inline route param objects.

Written by Cursor Bugbot for commit 840af66. This will update automatically on new commits. Configure here.

@asalsys asalsys requested a review from Cal-L February 2, 2026 20:47
@asalsys asalsys changed the title create root params list type chore: create root params list type Feb 2, 2026
@asalsys asalsys self-assigned this Feb 2, 2026
@asalsys asalsys added the team-mobile-platform Mobile Platform team label Feb 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@asalsys asalsys requested a review from andrepimenta February 3, 2026 15:05
@github-project-automation github-project-automation bot moved this to Needs dev review in PR review queue Feb 3, 2026
Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments! We're also missing defining the global type mentioned in #23762. After defining the global namespace, you can verify that the types are picked up by checking the useNavigation hook

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a types file and should be named types.ts. Let's also move it into the NavigationService directory


/**
* Navigation parameter types for all routes.
* This type mirrors the structure of Routes in Routes.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This most likely has missing items screen names since some things are hardcoded. In addition of this list, you can reference the navigation stacks to fill in the blanks.

* Navigation parameter types for all routes.
* This type mirrors the structure of Routes in Routes.ts
*/
export interface RouteParams {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RootParamsList below seems to be the correct definition. RouteParams seems duplicate and can be removed

// Individual Parameter Types
// ============================================================================

/** Browser navigation parameters */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The screen params themselves should be defined in the feature directories and follow the import pattern to respect CO scopes.

@asalsys asalsys requested a review from a team as a code owner February 3, 2026 18:17
@asalsys asalsys requested review from a team as code owners February 3, 2026 18:58
@asalsys asalsys dismissed stale reviews from Prithpal-Sooriya and vinnyhoward via 5677148 February 13, 2026 15:55
@asalsys asalsys requested a review from GuillaumeRx February 13, 2026 16:00
@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 92%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR introduces TypeScript type definitions for navigation parameters across the MetaMask Mobile app. The changes are purely compile-time TypeScript types with no runtime code changes:

  1. New centralized types file (app/core/NavigationService/types.ts): Creates a comprehensive RootStackParamList interface that consolidates navigation parameter types from various feature modules. This provides TypeScript autocomplete and error checking for navigation but has zero runtime impact.

  2. New type definition files: Multiple new .types.ts files created for various features (Bridge, Card, Earn, Ramp, AccountActions, MultichainAccounts, Modals, SendFlow, NetworkSelector, etc.) - all containing only TypeScript interfaces.

  3. Minor modifications to existing files: Small changes to export existing interfaces that were previously internal (e.g., BuildQuoteParams, OrderDetailsParams, ShareAddressQRParams). These are just adding export keywords to existing type definitions.

Why no E2E tests needed:

  • All changes are TypeScript type definitions only
  • No runtime code is modified
  • No component logic, UI rendering, or data flow changes
  • No state management changes
  • These are compile-time only changes for better type safety and developer experience
  • The app behavior remains completely unchanged

The changes improve code maintainability and TypeScript support without affecting any user-facing functionality.

Performance Test Selection:
These changes are purely TypeScript type definitions with no runtime code changes. Type definitions are compile-time only and have zero impact on app performance - they don't affect UI rendering, data loading, state management, or any runtime behavior. No performance tests are needed.

View GitHub Actions results

@GuillaumeRx GuillaumeRx dismissed their stale review February 13, 2026 16:25

No more core platform changes

@GuillaumeRx GuillaumeRx removed their request for review February 13, 2026 16:26
@sonarqubecloud
Copy link

@asalsys asalsys enabled auto-merge February 13, 2026 19:12
@Matt561 Matt561 self-requested a review February 13, 2026 20:31
@asalsys asalsys added this pull request to the merge queue Feb 17, 2026
@github-project-automation github-project-automation bot moved this from Needs more work from the author to Review finalised - Ready to be merged in PR review queue Feb 17, 2026
Merged via the queue into main with commit 011cccf Feb 17, 2026
77 of 78 checks passed
@asalsys asalsys deleted the chore/root-params-list-type branch February 17, 2026 17:37
@github-actions github-actions bot locked and limited conversation to collaborators Feb 17, 2026
@metamaskbot metamaskbot added the release-7.67.0 Issue or pull request that will be included in release 7.67.0 label Feb 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.67.0 Issue or pull request that will be included in release 7.67.0 size-XL team-mobile-platform Mobile Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

[NAV UPGRADE - 1] Specify default types for navigation API (ref, hooks, etc)