Skip to content

Commit

Permalink
fix unnecessary type assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Bangay committed Jul 30, 2024
1 parent 15fc1f2 commit d83e0d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
];
Expand Down
8 changes: 2 additions & 6 deletions client/components/mma/switch/SwitchContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
getBillingPeriodAdjective,
PRODUCT_TYPES,
} from '../../../../shared/productTypes';
import type { CurrencyIso } from '../../../utilities/currencyIso';
import {
LoadingState,
useAsyncLoader,
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions client/components/mma/upgrade/UpgradeSupport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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',
);

Expand Down

0 comments on commit d83e0d1

Please sign in to comment.