From 18e81ba8913831e2c3c10c2398f9ffcf6f26f40c Mon Sep 17 00:00:00 2001 From: Prithpal Sooriya Date: Mon, 4 Nov 2024 17:29:49 +0000 Subject: [PATCH] fix: notification settings type (#28271) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** This fixes a poor type from converting a selectors file from JS to TS. Instead of using a custom type for the accounts type, we can just use inferred types. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28271?quickstart=1) ## **Related issues** Fixes: https://github.com/MetaMask/metamask-extension/pull/27645#discussion_r1827945420 ## **Manual testing steps** N/A these are only type level changes ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. --- .../notifications-settings.tsx | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/ui/pages/notifications-settings/notifications-settings.tsx b/ui/pages/notifications-settings/notifications-settings.tsx index 0fafb468b733..7606fed99614 100644 --- a/ui/pages/notifications-settings/notifications-settings.tsx +++ b/ui/pages/notifications-settings/notifications-settings.tsx @@ -1,7 +1,6 @@ import React, { useMemo, useState } from 'react'; import { useSelector } from 'react-redux'; import { useHistory, useLocation } from 'react-router-dom'; -import type { InternalAccount } from '@metamask/keyring-api'; import { useI18nContext } from '../../hooks/useI18nContext'; import { NOTIFICATIONS_ROUTE } from '../../helpers/constants/routes'; import { @@ -33,18 +32,6 @@ import { NotificationsSettingsAllowNotifications } from './notifications-setting import { NotificationsSettingsTypes } from './notifications-settings-types'; import { NotificationsSettingsPerAccount } from './notifications-settings-per-account'; -// Define KeyringType interface -type KeyringType = { - type: string; -}; - -// Define AccountType interface -type AccountType = InternalAccount & { - balance: string; - keyring: KeyringType; - label: string; -}; - export default function NotificationsSettings() { const history = useHistory(); const location = useLocation(); @@ -57,7 +44,7 @@ export default function NotificationsSettings() { const isUpdatingMetamaskNotifications = useSelector( getIsUpdatingMetamaskNotifications, ); - const accounts = useSelector(getInternalAccounts) as AccountType[]; + const accounts = useSelector(getInternalAccounts); // States const [loadingAllowNotifications, setLoadingAllowNotifications] =