From d83e0d1e30afdff50f6948bea3d71e476d53fc60 Mon Sep 17 00:00:00 2001 From: Richard Bangay Date: Tue, 30 Jul 2024 12:13:17 +0100 Subject: [PATCH] fix unnecessary type assertions --- .../updateAmount/SupporterPlusUpdateAmountForm.tsx | 3 +-- client/components/mma/switch/SwitchContainer.tsx | 8 ++------ client/components/mma/upgrade/UpgradeSupport.tsx | 3 +-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/client/components/mma/accountoverview/updateAmount/SupporterPlusUpdateAmountForm.tsx b/client/components/mma/accountoverview/updateAmount/SupporterPlusUpdateAmountForm.tsx index 132406fed..8a554e846 100644 --- a/client/components/mma/accountoverview/updateAmount/SupporterPlusUpdateAmountForm.tsx +++ b/client/components/mma/accountoverview/updateAmount/SupporterPlusUpdateAmountForm.tsx @@ -19,7 +19,6 @@ import { import { useEffect, useState } from 'react'; import type { PaidSubscriptionPlan } from '../../../../../shared/productResponse'; import { getBillingPeriodAdjective } from '../../../../../shared/productTypes'; -import type { CurrencyIso } from '../../../../utilities/currencyIso'; import { fetchWithDefaultParameters } from '../../../../utilities/fetch'; import { getSupporterPlusSuggestedAmountsFromMainPlan } from '../../../../utilities/pricingConfig/suggestedAmounts'; import { supporterPlusPriceConfigByCountryGroup } from '../../../../utilities/pricingConfig/supporterPlusPricing'; @@ -106,7 +105,7 @@ export const SupporterPlusUpdateAmountForm = ( props: SupporterPlusUpdateAmountFormProps, ) => { const priceConfig = (supporterPlusPriceConfigByCountryGroup[ - props.mainPlan.currencyISO as CurrencyIso + props.mainPlan.currencyISO ] || supporterPlusPriceConfigByCountryGroup.international)[ props.mainPlan.billingPeriod ]; diff --git a/client/components/mma/switch/SwitchContainer.tsx b/client/components/mma/switch/SwitchContainer.tsx index 17e42feef..0dd2f9747 100644 --- a/client/components/mma/switch/SwitchContainer.tsx +++ b/client/components/mma/switch/SwitchContainer.tsx @@ -12,7 +12,6 @@ import { getBillingPeriodAdjective, PRODUCT_TYPES, } from '../../../../shared/productTypes'; -import type { CurrencyIso } from '../../../utilities/currencyIso'; import { LoadingState, useAsyncLoader, @@ -183,13 +182,10 @@ function getThresholds( monthly: boolean, ): Thresholds { const monthlyThreshold = getBenefitsThreshold( - mainPlan.currencyISO as CurrencyIso, + mainPlan.currencyISO, 'month', ); - const annualThreshold = getBenefitsThreshold( - mainPlan.currencyISO as CurrencyIso, - 'year', - ); + const annualThreshold = getBenefitsThreshold(mainPlan.currencyISO, 'year'); const thresholdForBillingPeriod = monthly ? monthlyThreshold : annualThreshold; diff --git a/client/components/mma/upgrade/UpgradeSupport.tsx b/client/components/mma/upgrade/UpgradeSupport.tsx index ab4d44bf7..0004d0bbe 100644 --- a/client/components/mma/upgrade/UpgradeSupport.tsx +++ b/client/components/mma/upgrade/UpgradeSupport.tsx @@ -10,7 +10,6 @@ import { Stack } from '@guardian/source/react-components'; import { useContext, useState } from 'react'; import { formatAmount } from '@/client/utilities/utils'; import type { PreviewResponse } from '../../../../shared/productSwitchTypes'; -import type { CurrencyIso } from '../../../utilities/currencyIso'; import { useAsyncLoader } from '../../../utilities/hooks/useAsyncLoader'; import { getContributionSuggestedAmounts } from '../../../utilities/pricingConfig/suggestedAmounts'; import { getBenefitsThreshold } from '../../../utilities/pricingConfig/supporterPlusPricing'; @@ -36,7 +35,7 @@ export const UpgradeSupport = () => { const currentAmount = mainPlan.price / 100; const threshold = getBenefitsThreshold( - mainPlan.currencyISO as CurrencyIso, + mainPlan.currencyISO, mainPlan.billingPeriod as 'month' | 'year', );