diff --git a/.eslintrc.js b/.eslintrc.js index 5e9ec7d06f..312443d67b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,6 +14,7 @@ module.exports = { rules: { 'multiline-comment-style': ['error', 'separate-lines'], 'rulesdir/enforce-retry-on-import': 'error', + 'rulesdir/no-undefined-or': 'error', }, }, { diff --git a/eslint_rules/no-undefined-or.js b/eslint_rules/no-undefined-or.js new file mode 100644 index 0000000000..0bae173622 --- /dev/null +++ b/eslint_rules/no-undefined-or.js @@ -0,0 +1,44 @@ +/* eslint-env node */ + +module.exports = { + meta: { + type: 'suggestion', + docs: { + description: 'Enforce the use of optional object fields', + category: 'Best Practices', + recommended: true, + }, + fixable: 'code', + schema: [], + }, + create(context) { + return { + 'TSPropertySignature > TSTypeAnnotation > TSUnionType': (node) => { + const types = node.types + const hasUndefined = types.some((typeNode) => typeNode.type === 'TSUndefinedKeyword') + + if (hasUndefined) { + const typesWithoutUndefined = types.filter((typeNode) => typeNode.type !== 'TSUndefinedKeyword') + + // If there is more than one type left after removing 'undefined', + // join them together with ' | ' to create a new union type. + const newTypeSource = + typesWithoutUndefined.length > 1 + ? typesWithoutUndefined.map((typeNode) => context.getSourceCode().getText(typeNode)).join(' | ') + : context.getSourceCode().getText(typesWithoutUndefined[0]) + + context.report({ + node, + message: `Prefer optional properties to "Type | undefined".`, + fix(fixer) { + const propertySignature = node.parent.parent + const isAlreadyOptional = propertySignature.optional + const newTypeAnnotation = isAlreadyOptional ? `: ${newTypeSource}` : `?: ${newTypeSource}` + return fixer.replaceText(node.parent, newTypeAnnotation) + }, + }) + } + }, + } + }, +} diff --git a/src/components/AccountDrawer/MiniPortfolio/Pools/useMultiChainPositions.tsx b/src/components/AccountDrawer/MiniPortfolio/Pools/useMultiChainPositions.tsx index 61bc84728c..09ef91318f 100644 --- a/src/components/AccountDrawer/MiniPortfolio/Pools/useMultiChainPositions.tsx +++ b/src/components/AccountDrawer/MiniPortfolio/Pools/useMultiChainPositions.tsx @@ -49,7 +49,7 @@ const DEFAULT_CHAINS = [ SupportedChainId.CELO, ] -type UseMultiChainPositionsData = { positions: PositionInfo[] | undefined; loading: boolean } +type UseMultiChainPositionsData = { positions?: PositionInfo[]; loading: boolean } /** * Returns all positions for a given account on multiple chains. diff --git a/src/components/Badge/RangeBadge.tsx b/src/components/Badge/RangeBadge.tsx index a8a3115546..2d485ad39a 100644 --- a/src/components/Badge/RangeBadge.tsx +++ b/src/components/Badge/RangeBadge.tsx @@ -32,13 +32,7 @@ const LabelText = styled.div<{ color: string }>` justify-content: flex-end; ` -export default function RangeBadge({ - removed, - inRange, -}: { - removed: boolean | undefined - inRange: boolean | undefined -}) { +export default function RangeBadge({ removed, inRange }: { removed?: boolean; inRange?: boolean }) { const theme = useTheme() return ( diff --git a/src/components/Charts/SparklineChart.tsx b/src/components/Charts/SparklineChart.tsx index 7c9b455999..54694754b6 100644 --- a/src/components/Charts/SparklineChart.tsx +++ b/src/components/Charts/SparklineChart.tsx @@ -19,7 +19,7 @@ interface SparklineChartProps { width: number height: number tokenData: TopToken - pricePercentChange: number | undefined | null + pricePercentChange?: number | null sparklineMap: SparklineMap } diff --git a/src/components/ConnectedAccountBlocked/index.tsx b/src/components/ConnectedAccountBlocked/index.tsx index 2168069c5a..60376a01c8 100644 --- a/src/components/ConnectedAccountBlocked/index.tsx +++ b/src/components/ConnectedAccountBlocked/index.tsx @@ -14,7 +14,7 @@ const ContentWrapper = styled(Column)` font-size: 12px; ` interface ConnectedAccountBlockedProps { - account: string | null | undefined + account?: string | null isOpen: boolean } diff --git a/src/components/FeeSelector/index.tsx b/src/components/FeeSelector/index.tsx index 286fc28c6c..2cfa86b0e0 100644 --- a/src/components/FeeSelector/index.tsx +++ b/src/components/FeeSelector/index.tsx @@ -56,8 +56,8 @@ export default function FeeSelector({ disabled?: boolean feeAmount?: FeeAmount handleFeePoolSelect: (feeAmount: FeeAmount) => void - currencyA?: Currency | undefined - currencyB?: Currency | undefined + currencyA?: Currency + currencyB?: Currency }) { const { chainId } = useWeb3React() diff --git a/src/components/InputStepCounter/InputStepCounter.tsx b/src/components/InputStepCounter/InputStepCounter.tsx index d9ec0ebff9..ae99b3eb54 100644 --- a/src/components/InputStepCounter/InputStepCounter.tsx +++ b/src/components/InputStepCounter/InputStepCounter.tsx @@ -79,8 +79,8 @@ interface StepCounterProps { width?: string locked?: boolean // disable input title: ReactNode - tokenA: string | undefined - tokenB: string | undefined + tokenA?: string + tokenB?: string } const StepCounter = ({ diff --git a/src/components/LiquidityChartRangeInput/Area.tsx b/src/components/LiquidityChartRangeInput/Area.tsx index 9a37d01635..316e3d9353 100644 --- a/src/components/LiquidityChartRangeInput/Area.tsx +++ b/src/components/LiquidityChartRangeInput/Area.tsx @@ -4,7 +4,7 @@ import styled from 'styled-components/macro' import { ChartEntry } from './types' -const Path = styled.path<{ fill: string | undefined }>` +const Path = styled.path<{ fill?: string }>` opacity: 0.5; stroke: ${({ fill, theme }) => fill ?? theme.accentAction}; fill: ${({ fill, theme }) => fill ?? theme.accentAction}; @@ -23,7 +23,7 @@ export const Area = ({ yScale: ScaleLinear xValue: (d: ChartEntry) => number yValue: (d: ChartEntry) => number - fill?: string | undefined + fill?: string }) => useMemo( () => ( diff --git a/src/components/LiquidityChartRangeInput/hooks.ts b/src/components/LiquidityChartRangeInput/hooks.ts index 04ea22fd7d..b342553830 100644 --- a/src/components/LiquidityChartRangeInput/hooks.ts +++ b/src/components/LiquidityChartRangeInput/hooks.ts @@ -10,9 +10,9 @@ export function useDensityChartData({ currencyB, feeAmount, }: { - currencyA: Currency | undefined - currencyB: Currency | undefined - feeAmount: FeeAmount | undefined + currencyA?: Currency + currencyB?: Currency + feeAmount?: FeeAmount }) { const { isLoading, error, data } = usePoolActiveLiquidity(currencyA, currencyB, feeAmount) diff --git a/src/components/LiquidityChartRangeInput/index.tsx b/src/components/LiquidityChartRangeInput/index.tsx index daf1452691..59cb11ba31 100644 --- a/src/components/LiquidityChartRangeInput/index.tsx +++ b/src/components/LiquidityChartRangeInput/index.tsx @@ -76,11 +76,11 @@ export default function LiquidityChartRangeInput({ onRightRangeInput, interactive, }: { - currencyA: Currency | undefined - currencyB: Currency | undefined + currencyA?: Currency + currencyB?: Currency feeAmount?: FeeAmount ticksAtLimit: { [bound in Bound]?: boolean | undefined } - price: number | undefined + price?: number priceLower?: Price priceUpper?: Price onLeftRangeInput: (typedValue: string) => void diff --git a/src/components/LiquidityChartRangeInput/types.ts b/src/components/LiquidityChartRangeInput/types.ts index 82e762f92a..15984592ea 100644 --- a/src/components/LiquidityChartRangeInput/types.ts +++ b/src/components/LiquidityChartRangeInput/types.ts @@ -54,7 +54,7 @@ export interface LiquidityChartRangeInputProps { interactive?: boolean brushLabels: (d: 'w' | 'e', x: number) => string - brushDomain: [number, number] | undefined + brushDomain?: [number, number] onBrushDomainChange: (domain: [number, number], mode: string | undefined) => void zoomLevels: ZoomLevels diff --git a/src/components/ModalViews/index.tsx b/src/components/ModalViews/index.tsx index 4b8a06827b..75977d3b27 100644 --- a/src/components/ModalViews/index.tsx +++ b/src/components/ModalViews/index.tsx @@ -39,15 +39,7 @@ export function LoadingView({ children, onDismiss }: { children: any; onDismiss: ) } -export function SubmittedView({ - children, - onDismiss, - hash, -}: { - children: any - onDismiss: () => void - hash: string | undefined -}) { +export function SubmittedView({ children, onDismiss, hash }: { children: any; onDismiss: () => void; hash?: string }) { const theme = useTheme() const { chainId } = useWeb3React() diff --git a/src/components/NavBar/SearchBarDropdown.tsx b/src/components/NavBar/SearchBarDropdown.tsx index 2c25192485..9bc4a0e928 100644 --- a/src/components/NavBar/SearchBarDropdown.tsx +++ b/src/components/NavBar/SearchBarDropdown.tsx @@ -33,7 +33,7 @@ interface SearchBarDropdownSectionProps { suggestions: (GenieCollection | SearchToken)[] header: JSX.Element headerIcon?: JSX.Element - hoveredIndex: number | undefined + hoveredIndex?: number startingIndex: number setHoveredIndex: (index: number | undefined) => void isLoading?: boolean diff --git a/src/components/NavigationTabs/index.tsx b/src/components/NavigationTabs/index.tsx index 29044293fb..bb5d892ffe 100644 --- a/src/components/NavigationTabs/index.tsx +++ b/src/components/NavigationTabs/index.tsx @@ -21,7 +21,7 @@ const Tabs = styled.div` justify-content: space-evenly; ` -const StyledHistoryLink = styled(HistoryLink)<{ flex: string | undefined }>` +const StyledHistoryLink = styled(HistoryLink)<{ flex?: string }>` flex: ${({ flex }) => flex ?? 'none'}; ${({ theme }) => theme.deprecated_mediaWidth.deprecated_upToMedium` @@ -64,9 +64,9 @@ export function AddRemoveTabs({ adding: boolean creating: boolean autoSlippage: Percent - positionID?: string | undefined + positionID?: string showBackLink?: boolean - children?: ReactNode | undefined + children?: ReactNode }) { const theme = useTheme() // reset states on back diff --git a/src/components/NumericalInput/index.tsx b/src/components/NumericalInput/index.tsx index 3db5627a58..ed6ae7e80e 100644 --- a/src/components/NumericalInput/index.tsx +++ b/src/components/NumericalInput/index.tsx @@ -53,7 +53,7 @@ export const Input = React.memo(function InnerInput({ error?: boolean fontSize?: string align?: 'right' | 'left' - prependSymbol?: string | undefined + prependSymbol?: string } & Omit, 'ref' | 'onChange' | 'as'>) { const enforcer = (nextUserInput: string) => { if (nextUserInput === '' || inputRegex.test(escapeRegExp(nextUserInput))) { diff --git a/src/components/PositionPreview/index.tsx b/src/components/PositionPreview/index.tsx index 005ab5bbd1..abbde8ffd8 100644 --- a/src/components/PositionPreview/index.tsx +++ b/src/components/PositionPreview/index.tsx @@ -27,7 +27,7 @@ export const PositionPreview = ({ position: Position title?: ReactNode inRange: boolean - baseCurrencyDefault?: Currency | undefined + baseCurrencyDefault?: Currency ticksAtLimit: { [bound: string]: boolean | undefined } }) => { const theme = useTheme() diff --git a/src/components/Tokens/TokenDetails/About.tsx b/src/components/Tokens/TokenDetails/About.tsx index c3963d10a3..bbc7a5ca31 100644 --- a/src/components/Tokens/TokenDetails/About.tsx +++ b/src/components/Tokens/TokenDetails/About.tsx @@ -68,9 +68,9 @@ const ResourcesContainer = styled.div` type AboutSectionProps = { address: string chainId: SupportedChainId - description?: string | null | undefined - homepageUrl?: string | null | undefined - twitterName?: string | null | undefined + description?: string | null + homepageUrl?: string | null + twitterName?: string | null } export function AboutSection({ address, chainId, description, homepageUrl, twitterName }: AboutSectionProps) { diff --git a/src/components/Tokens/TokenDetails/PriceChart.tsx b/src/components/Tokens/TokenDetails/PriceChart.tsx index f78bd48629..20e93be56e 100644 --- a/src/components/Tokens/TokenDetails/PriceChart.tsx +++ b/src/components/Tokens/TokenDetails/PriceChart.tsx @@ -64,7 +64,7 @@ export function formatDelta(delta: number | null | undefined) { return formattedDelta } -export const DeltaText = styled.span<{ delta: number | undefined }>` +export const DeltaText = styled.span<{ delta?: number }>` color: ${({ theme, delta }) => delta !== undefined ? (Math.sign(delta) < 0 ? theme.accentFailure : theme.accentSuccess) : theme.textPrimary}; ` @@ -124,7 +124,7 @@ const timeOptionsHeight = 44 interface PriceChartProps { width: number height: number - prices: PricePoint[] | undefined | null + prices?: PricePoint[] | null timePeriod: TimePeriod } diff --git a/src/components/Tokens/TokenDetails/index.tsx b/src/components/Tokens/TokenDetails/index.tsx index 40010c3bbc..1a07667252 100644 --- a/src/components/Tokens/TokenDetails/index.tsx +++ b/src/components/Tokens/TokenDetails/index.tsx @@ -87,11 +87,11 @@ function useRelevantToken( } type TokenDetailsProps = { - urlAddress: string | undefined + urlAddress?: string inputTokenAddress?: string chain: Chain tokenQuery: TokenQuery - tokenPriceQuery: TokenPriceQuery | undefined + tokenPriceQuery?: TokenPriceQuery onChangeTimePeriod: OnChangeTimePeriod } export default function TokenDetails({ diff --git a/src/components/TransactionConfirmationModal/index.tsx b/src/components/TransactionConfirmationModal/index.tsx index 882af9b1a0..bf975523c1 100644 --- a/src/components/TransactionConfirmationModal/index.tsx +++ b/src/components/TransactionConfirmationModal/index.tsx @@ -94,9 +94,9 @@ function TransactionSubmittedContent({ inline, }: { onDismiss: () => void - hash: string | undefined + hash?: string chainId: number - currencyToAdd?: Currency | undefined + currencyToAdd?: Currency inline?: boolean // not in modal }) { const theme = useTheme() @@ -229,9 +229,9 @@ function L2Content({ inline, }: { onDismiss: () => void - hash: string | undefined + hash?: string chainId: SupportedL2ChainId - currencyToAdd?: Currency | undefined + currencyToAdd?: Currency pendingText: ReactNode inline?: boolean // not in modal }) { @@ -324,11 +324,11 @@ function L2Content({ interface ConfirmationModalProps { isOpen: boolean onDismiss: () => void - hash: string | undefined + hash?: string content: () => ReactNode attemptingTxn: boolean pendingText: ReactNode - currencyToAdd?: Currency | undefined + currencyToAdd?: Currency } export default function TransactionConfirmationModal({ diff --git a/src/components/swap/ConfirmSwapModal.tsx b/src/components/swap/ConfirmSwapModal.tsx index 8571a902c3..ddaed34c32 100644 --- a/src/components/swap/ConfirmSwapModal.tsx +++ b/src/components/swap/ConfirmSwapModal.tsx @@ -30,15 +30,15 @@ export default function ConfirmSwapModal({ fiatValueOutput, }: { trade: InterfaceTrade - originalTrade: InterfaceTrade | undefined + originalTrade?: InterfaceTrade attemptingTxn: boolean - txHash: string | undefined + txHash?: string allowedSlippage: Percent onAcceptChanges: () => void onConfirm: () => void - swapErrorMessage: ReactNode | undefined + swapErrorMessage?: ReactNode onDismiss: () => void - swapQuoteReceivedDate: Date | undefined + swapQuoteReceivedDate?: Date fiatValueInput: { data?: number; isLoading: boolean } fiatValueOutput: { data?: number; isLoading: boolean } }) { diff --git a/src/components/swap/SwapDetailsDropdown.tsx b/src/components/swap/SwapDetailsDropdown.tsx index e517ba718d..923eb69655 100644 --- a/src/components/swap/SwapDetailsDropdown.tsx +++ b/src/components/swap/SwapDetailsDropdown.tsx @@ -92,7 +92,7 @@ const Wrapper = styled(Column)` ` interface SwapDetailsInlineProps { - trade: InterfaceTrade | undefined + trade?: InterfaceTrade syncing: boolean loading: boolean allowedSlippage: Percent diff --git a/src/components/swap/SwapModalFooter.tsx b/src/components/swap/SwapModalFooter.tsx index ff254431c6..b2f10bfeff 100644 --- a/src/components/swap/SwapModalFooter.tsx +++ b/src/components/swap/SwapModalFooter.tsx @@ -58,12 +58,12 @@ export default function SwapModalFooter({ onAcceptChanges, }: { trade: InterfaceTrade - hash: string | undefined + hash?: string allowedSlippage: Percent onConfirm: () => void - swapErrorMessage: ReactNode | undefined + swapErrorMessage?: ReactNode disabledConfirm: boolean - swapQuoteReceivedDate: Date | undefined + swapQuoteReceivedDate?: Date fiatValueInput: { data?: number; isLoading: boolean } fiatValueOutput: { data?: number; isLoading: boolean } showAcceptChanges: boolean diff --git a/src/components/swap/SwapModalHeaderAmount.tsx b/src/components/swap/SwapModalHeaderAmount.tsx index 8f9821b9a4..e021ddc35a 100644 --- a/src/components/swap/SwapModalHeaderAmount.tsx +++ b/src/components/swap/SwapModalHeaderAmount.tsx @@ -33,7 +33,7 @@ interface AmountProps { field: Field tooltipText?: ReactNode label: ReactNode - amount: CurrencyAmount | undefined + amount?: CurrencyAmount usdAmount?: number } diff --git a/src/components/swap/styleds.tsx b/src/components/swap/styleds.tsx index b648cd6f3a..3b65064e50 100644 --- a/src/components/swap/styleds.tsx +++ b/src/components/swap/styleds.tsx @@ -22,7 +22,7 @@ export const PageWrapper = styled.div` ` // Mostly copied from `AppBody` but it was getting too hard to maintain backwards compatibility. -export const SwapWrapper = styled.main<{ chainId: number | undefined }>` +export const SwapWrapper = styled.main<{ chainId?: number }>` position: relative; background: ${({ theme }) => theme.backgroundSurface}; border-radius: 16px; diff --git a/src/components/vote/ExecuteModal.tsx b/src/components/vote/ExecuteModal.tsx index 5ae2366436..2b6f54213c 100644 --- a/src/components/vote/ExecuteModal.tsx +++ b/src/components/vote/ExecuteModal.tsx @@ -37,7 +37,7 @@ const ConfirmedIcon = styled(ColumnCenter)` interface ExecuteModalProps { isOpen: boolean onDismiss: () => void - proposalId: string | undefined // id for the proposal to execute + proposalId?: string // id for the proposal to execute } export default function ExecuteModal({ isOpen, onDismiss, proposalId }: ExecuteModalProps) { diff --git a/src/components/vote/QueueModal.tsx b/src/components/vote/QueueModal.tsx index 2f2be43dec..6569f6012c 100644 --- a/src/components/vote/QueueModal.tsx +++ b/src/components/vote/QueueModal.tsx @@ -37,7 +37,7 @@ const ConfirmedIcon = styled(ColumnCenter)` interface QueueModalProps { isOpen: boolean onDismiss: () => void - proposalId: string | undefined // id for the proposal to queue + proposalId?: string // id for the proposal to queue } export default function QueueModal({ isOpen, onDismiss, proposalId }: QueueModalProps) { diff --git a/src/components/vote/VoteModal.tsx b/src/components/vote/VoteModal.tsx index 92222df07b..36e4b127e0 100644 --- a/src/components/vote/VoteModal.tsx +++ b/src/components/vote/VoteModal.tsx @@ -39,8 +39,8 @@ const ConfirmedIcon = styled(ColumnCenter)` interface VoteModalProps { isOpen: boolean onDismiss: () => void - voteOption: VoteOption | undefined - proposalId: string | undefined // id for the proposal to vote on + voteOption?: VoteOption + proposalId?: string // id for the proposal to vote on } export default function VoteModal({ isOpen, onDismiss, proposalId, voteOption }: VoteModalProps) { diff --git a/src/graphql/data/TopTokens.ts b/src/graphql/data/TopTokens.ts index 2e413c5cf4..906e4cf79d 100644 --- a/src/graphql/data/TopTokens.ts +++ b/src/graphql/data/TopTokens.ts @@ -140,7 +140,7 @@ export type SparklineMap = { [key: string]: PricePoint[] | undefined } export type TopToken = NonNullable['topTokens']>[number] interface UseTopTokensReturnValue { - tokens: TopToken[] | undefined + tokens?: TopToken[] tokenSortRank: Record loadingTokens: boolean sparklines: SparklineMap diff --git a/src/graphql/data/util.tsx b/src/graphql/data/util.tsx index 780bc5eb83..df36054958 100644 --- a/src/graphql/data/util.tsx +++ b/src/graphql/data/util.tsx @@ -153,7 +153,7 @@ export function getTokenDetailsURL({ export function unwrapToken< T extends { - address?: string | null | undefined + address?: string | null } | null >(chainId: number, token: T): T { if (!token?.address) return token diff --git a/src/graphql/thegraph/FeeTierDistributionQuery.ts b/src/graphql/thegraph/FeeTierDistributionQuery.ts index 5778a3eda5..3a60c39955 100644 --- a/src/graphql/thegraph/FeeTierDistributionQuery.ts +++ b/src/graphql/thegraph/FeeTierDistributionQuery.ts @@ -37,7 +37,7 @@ export default function useFeeTierDistributionQuery( token0: string | undefined, token1: string | undefined, interval: number -): { error: ApolloError | undefined; isLoading: boolean; data: FeeTierDistributionQuery } { +): { error?: ApolloError; isLoading: boolean; data: FeeTierDistributionQuery } { const { data, loading: isLoading, diff --git a/src/hooks/useClientSideV3Trade.ts b/src/hooks/useClientSideV3Trade.ts index 6283eb3d59..58133b6ecc 100644 --- a/src/hooks/useClientSideV3Trade.ts +++ b/src/hooks/useClientSideV3Trade.ts @@ -33,7 +33,7 @@ export function useClientSideV3Trade( tradeType: TTradeType, amountSpecified?: CurrencyAmount, otherCurrency?: Currency -): { state: TradeState; trade: InterfaceTrade | undefined } { +): { state: TradeState; trade?: InterfaceTrade } { const [currencyIn, currencyOut] = tradeType === TradeType.EXACT_INPUT ? [amountSpecified?.currency, otherCurrency] diff --git a/src/hooks/useDerivedPositionInfo.ts b/src/hooks/useDerivedPositionInfo.ts index 99c1cb1fd2..55a42d1232 100644 --- a/src/hooks/useDerivedPositionInfo.ts +++ b/src/hooks/useDerivedPositionInfo.ts @@ -5,8 +5,8 @@ import { PositionDetails } from 'types/position' import { useCurrency } from './Tokens' export function useDerivedPositionInfo(positionDetails: PositionDetails | undefined): { - position: Position | undefined - pool: Pool | undefined + position?: Position + pool?: Pool } { const currency0 = useCurrency(positionDetails?.token0) const currency1 = useCurrency(positionDetails?.token1) diff --git a/src/hooks/useFeeTierDistribution.ts b/src/hooks/useFeeTierDistribution.ts index 1b613ceb48..b876b818dd 100644 --- a/src/hooks/useFeeTierDistribution.ts +++ b/src/hooks/useFeeTierDistribution.ts @@ -13,7 +13,7 @@ const MAX_DATA_BLOCK_AGE = 20 interface FeeTierDistribution { isLoading: boolean isError: boolean - largestUsageFeeTier?: FeeAmount | undefined + largestUsageFeeTier?: FeeAmount // distributions as percentages of overall liquidity distributions?: Record diff --git a/src/hooks/usePoolTickData.ts b/src/hooks/usePoolTickData.ts index fdd85cdc22..30c974f478 100644 --- a/src/hooks/usePoolTickData.ts +++ b/src/hooks/usePoolTickData.ts @@ -174,7 +174,7 @@ function useAllV3Ticks( ): { isLoading: boolean error: unknown - ticks: TickData[] | undefined + ticks?: TickData[] } { const useSubgraph = currencyA ? !CHAIN_IDS_MISSING_SUBGRAPH_DATA.includes(currencyA.chainId) : true @@ -213,8 +213,8 @@ export function usePoolActiveLiquidity( ): { isLoading: boolean error: any - activeTick: number | undefined - data: TickProcessed[] | undefined + activeTick?: number + data?: TickProcessed[] } { const pool = usePool(currencyA, currencyB, feeAmount) diff --git a/src/hooks/useSwapCallback.tsx b/src/hooks/useSwapCallback.tsx index 75da85c15b..a615fe3c62 100644 --- a/src/hooks/useSwapCallback.tsx +++ b/src/hooks/useSwapCallback.tsx @@ -13,7 +13,7 @@ import { useUniversalRouterSwapCallback } from './useUniversalRouter' // and the user has approved the slippage adjusted input amount for the trade export function useSwapCallback( trade: Trade | undefined, // trade to execute, required - fiatValues: { amountIn: number | undefined; amountOut: number | undefined }, // usd values for amount in and out, logged for analytics + fiatValues: { amountIn?: number; amountOut?: number }, // usd values for amount in and out, logged for analytics allowedSlippage: Percent, // in bips permitSignature: PermitSignature | undefined ): { callback: null | (() => Promise) } { diff --git a/src/hooks/useTokenAllowance.ts b/src/hooks/useTokenAllowance.ts index f88b38abdb..7868fad51e 100644 --- a/src/hooks/useTokenAllowance.ts +++ b/src/hooks/useTokenAllowance.ts @@ -11,7 +11,7 @@ export function useTokenAllowance( owner?: string, spender?: string ): { - tokenAllowance: CurrencyAmount | undefined + tokenAllowance?: CurrencyAmount isSyncing: boolean } { const contract = useTokenContract(token?.address, false) @@ -21,7 +21,7 @@ export function useTokenAllowance( // This guarantees that the tokenAllowance is marked isSyncing upon approval and updated upon being synced. const [blocksPerFetch, setBlocksPerFetch] = useState<1>() const { result, syncing: isSyncing } = useSingleCallResult(contract, 'allowance', inputs, { blocksPerFetch }) as { - result: Awaited['allowance']>> | undefined + result?: Awaited['allowance']>> syncing: boolean } diff --git a/src/hooks/useUSDPrice.ts b/src/hooks/useUSDPrice.ts index 56782ba2f8..afd5cb2f19 100644 --- a/src/hooks/useUSDPrice.ts +++ b/src/hooks/useUSDPrice.ts @@ -21,7 +21,7 @@ const ETH_AMOUNT_OUT: { [chainId: number]: CurrencyAmount } = { } function useETHValue(currencyAmount?: CurrencyAmount): { - data: CurrencyAmount | undefined + data?: CurrencyAmount isLoading: boolean } { const chainId = currencyAmount?.currency?.chainId @@ -51,7 +51,7 @@ function useETHValue(currencyAmount?: CurrencyAmount): { } export function useUSDPrice(currencyAmount?: CurrencyAmount): { - data: number | undefined + data?: number isLoading: boolean } { const chain = currencyAmount?.currency.chainId ? chainIdToBackendName(currencyAmount?.currency.chainId) : undefined diff --git a/src/hooks/useUniversalRouter.ts b/src/hooks/useUniversalRouter.ts index 1ee2a2f13c..c069332fce 100644 --- a/src/hooks/useUniversalRouter.ts +++ b/src/hooks/useUniversalRouter.ts @@ -45,7 +45,7 @@ interface SwapOptions { export function useUniversalRouterSwapCallback( trade: Trade | undefined, - fiatValues: { amountIn: number | undefined; amountOut: number | undefined }, + fiatValues: { amountIn?: number; amountOut?: number }, options: SwapOptions ) { const { account, chainId, provider } = useWeb3React() diff --git a/src/hooks/useV3Positions.ts b/src/hooks/useV3Positions.ts index b7d4f0415b..4bab276119 100644 --- a/src/hooks/useV3Positions.ts +++ b/src/hooks/useV3Positions.ts @@ -7,7 +7,7 @@ import { useV3NFTPositionManagerContract } from './useContract' interface UseV3PositionsResults { loading: boolean - positions: PositionDetails[] | undefined + positions?: PositionDetails[] } function useV3PositionsFromTokenIds(tokenIds: BigNumber[] | undefined): UseV3PositionsResults { @@ -51,7 +51,7 @@ function useV3PositionsFromTokenIds(tokenIds: BigNumber[] | undefined): UseV3Pos interface UseV3PositionResults { loading: boolean - position: PositionDetails | undefined + position?: PositionDetails } export function useV3PositionFromTokenId(tokenId: BigNumber | undefined): UseV3PositionResults { diff --git a/src/hooks/useWrapCallback.tsx b/src/hooks/useWrapCallback.tsx index 5c91e1f347..3f844174f1 100644 --- a/src/hooks/useWrapCallback.tsx +++ b/src/hooks/useWrapCallback.tsx @@ -60,7 +60,7 @@ export default function useWrapCallback( inputCurrency: Currency | undefined | null, outputCurrency: Currency | undefined | null, typedValue: string | undefined -): { wrapType: WrapType; execute?: undefined | (() => Promise); inputError?: WrapInputError } { +): { wrapType: WrapType; execute?: () => Promise; inputError?: WrapInputError } { const { chainId, account } = useWeb3React() const wethContract = useWETHContract() const balance = useCurrencyBalance(account ?? undefined, inputCurrency ?? undefined) diff --git a/src/lib/hooks/routing/useRoutingAPIArguments.ts b/src/lib/hooks/routing/useRoutingAPIArguments.ts index e97504a2a8..53e6c1dd2e 100644 --- a/src/lib/hooks/routing/useRoutingAPIArguments.ts +++ b/src/lib/hooks/routing/useRoutingAPIArguments.ts @@ -15,9 +15,9 @@ export function useRoutingAPIArguments({ tradeType, routerPreference, }: { - tokenIn: Currency | undefined - tokenOut: Currency | undefined - amount: CurrencyAmount | undefined + tokenIn?: Currency + tokenOut?: Currency + amount?: CurrencyAmount tradeType: TradeType routerPreference: RouterPreference | typeof INTERNAL_ROUTER_PREFERENCE_PRICE }) { diff --git a/src/lib/utils/analytics.ts b/src/lib/utils/analytics.ts index 3a4ba13ad9..5956c157bf 100644 --- a/src/lib/utils/analytics.ts +++ b/src/lib/utils/analytics.ts @@ -40,7 +40,7 @@ export const formatSwapSignedAnalyticsEventProperties = ({ txHash, }: { trade: InterfaceTrade | Trade - fiatValues: { amountIn: number | undefined; amountOut: number | undefined } + fiatValues: { amountIn?: number; amountOut?: number } txHash: string }) => ({ transaction_hash: txHash, diff --git a/src/lib/utils/formatLocaleNumber.ts b/src/lib/utils/formatLocaleNumber.ts index 72c3fa9cb8..652e42a658 100644 --- a/src/lib/utils/formatLocaleNumber.ts +++ b/src/lib/utils/formatLocaleNumber.ts @@ -3,7 +3,7 @@ import { DEFAULT_LOCALE, SUPPORTED_LOCALES } from 'constants/locales' interface FormatLocaleNumberArgs { number: CurrencyAmount | Price | number - locale: string | null | undefined + locale?: string | null options?: Intl.NumberFormatOptions sigFigs?: number fixedDecimals?: number diff --git a/src/lib/utils/parseENSAddress.ts b/src/lib/utils/parseENSAddress.ts index ababade998..d331ce80b3 100644 --- a/src/lib/utils/parseENSAddress.ts +++ b/src/lib/utils/parseENSAddress.ts @@ -1,8 +1,6 @@ const ENS_NAME_REGEX = /^(([a-zA-Z0-9]+(-[a-zA-Z0-9]+)*\.)+)eth(\/.*)?$/ -export default function parseENSAddress( - ensAddress: string -): { ensName: string; ensPath: string | undefined } | undefined { +export default function parseENSAddress(ensAddress: string): { ensName: string; ensPath?: string } | undefined { const match = ensAddress.match(ENS_NAME_REGEX) if (!match) return undefined return { ensName: `${match[1].toLowerCase()}eth`, ensPath: match[4] } diff --git a/src/nft/components/bag/BagFooter.tsx b/src/nft/components/bag/BagFooter.tsx index 1a51800afc..2d9c36cbd6 100644 --- a/src/nft/components/bag/BagFooter.tsx +++ b/src/nft/components/bag/BagFooter.tsx @@ -206,9 +206,9 @@ const InputCurrencyValue = ({ }: { usingPayWithAnyToken: boolean totalEthPrice: BigNumber - activeCurrency: Currency | undefined | null + activeCurrency?: Currency | null tradeState: TradeState - trade: InterfaceTrade | undefined + trade?: InterfaceTrade }) => { if (!usingPayWithAnyToken) { return ( @@ -241,7 +241,7 @@ const FiatValue = ({ usingPayWithAnyToken, }: { usdcValue: CurrencyAmount | null - priceImpact: PriceImpact | undefined + priceImpact?: PriceImpact tradeState: TradeState usingPayWithAnyToken: boolean }) => { diff --git a/src/nft/components/bag/BagRow.tsx b/src/nft/components/bag/BagRow.tsx index a63dd19dbb..74347d326c 100644 --- a/src/nft/components/bag/BagRow.tsx +++ b/src/nft/components/bag/BagRow.tsx @@ -82,7 +82,7 @@ const NoContentContainer = () => ( interface BagRowProps { asset: UpdatedGenieAsset - usdPrice: number | undefined + usdPrice?: number removeAsset: (assets: GenieAsset[]) => void showRemove?: boolean grayscale?: boolean @@ -168,7 +168,7 @@ export const BagRow = ({ asset, usdPrice, removeAsset, showRemove, grayscale, is interface PriceChangeBagRowProps { asset: UpdatedGenieAsset - usdPrice: number | undefined + usdPrice?: number markAssetAsReviewed: (asset: UpdatedGenieAsset, toKeep: boolean) => void top?: boolean isMobile: boolean @@ -219,7 +219,7 @@ export const PriceChangeBagRow = ({ asset, usdPrice, markAssetAsReviewed, top, i interface UnavailableAssetsHeaderRowProps { assets?: UpdatedGenieAsset[] - usdPrice: number | undefined + usdPrice?: number clearUnavailableAssets: () => void didOpenUnavailableAssets: boolean setDidOpenUnavailableAssets: (didOpen: boolean) => void diff --git a/src/nft/components/collection/Sweep.tsx b/src/nft/components/collection/Sweep.tsx index 63f9ee5600..35a056d3dc 100644 --- a/src/nft/components/collection/Sweep.tsx +++ b/src/nft/components/collection/Sweep.tsx @@ -111,7 +111,7 @@ const NftDisplayContainer = styled.div` height: 34px; ` -const NftHolder = styled.div<{ index: number; src: string | undefined }>` +const NftHolder = styled.div<{ index: number; src?: string }>` position: absolute; top: 50%; left: 50%; diff --git a/src/nft/components/details/AssetActivity.tsx b/src/nft/components/details/AssetActivity.tsx index e8f9960712..62eacc406a 100644 --- a/src/nft/components/details/AssetActivity.tsx +++ b/src/nft/components/details/AssetActivity.tsx @@ -147,7 +147,7 @@ export const LoadingAssetActivity = ({ rowCount }: { rowCount: number }) => { ) } -const AssetActivity = ({ events }: { events: ActivityEvent[] | undefined }) => { +const AssetActivity = ({ events }: { events?: ActivityEvent[] }) => { return ( {events && diff --git a/src/nft/components/details/detailsV2/MediaRenderer.tsx b/src/nft/components/details/detailsV2/MediaRenderer.tsx index e8ed1fc96d..daef71ae42 100644 --- a/src/nft/components/details/detailsV2/MediaRenderer.tsx +++ b/src/nft/components/details/detailsV2/MediaRenderer.tsx @@ -128,7 +128,7 @@ function assetMediaType(asset: GenieAsset): MediaType { return MediaType.Image } -const RenderMediaShadow = ({ imageUrl }: { imageUrl: string | undefined }) => { +const RenderMediaShadow = ({ imageUrl }: { imageUrl?: string }) => { const [contentNotAvailable, setContentNotAvailable] = useState(false) if (!imageUrl || contentNotAvailable) { diff --git a/src/nft/components/profile/list/PriceTextInput.tsx b/src/nft/components/profile/list/PriceTextInput.tsx index 3f3ea7225c..9c97e37b5c 100644 --- a/src/nft/components/profile/list/PriceTextInput.tsx +++ b/src/nft/components/profile/list/PriceTextInput.tsx @@ -32,7 +32,7 @@ const InputWrapper = styled(Row)<{ borderColor: string }>` box-sizing: border-box; ` -const CurrencyWrapper = styled.div<{ listPrice: number | undefined }>` +const CurrencyWrapper = styled.div<{ listPrice?: number }>` color: ${({ listPrice, theme }) => (listPrice ? theme.textPrimary : theme.textSecondary)}; ` diff --git a/src/nft/components/profile/view/ProfilePage.tsx b/src/nft/components/profile/view/ProfilePage.tsx index 1e1f49ac01..5c828c427a 100644 --- a/src/nft/components/profile/view/ProfilePage.tsx +++ b/src/nft/components/profile/view/ProfilePage.tsx @@ -313,7 +313,7 @@ const CollectionFilterItem = ({ collection, setCollectionFilters, }: { - collection: WalletCollection | undefined + collection?: WalletCollection setCollectionFilters: (address: string) => void }) => { if (!collection) return null diff --git a/src/nft/hooks/useDerivedPayWithAnyTokenSwapInfo.ts b/src/nft/hooks/useDerivedPayWithAnyTokenSwapInfo.ts index 09473ecd89..e216baa2da 100644 --- a/src/nft/hooks/useDerivedPayWithAnyTokenSwapInfo.ts +++ b/src/nft/hooks/useDerivedPayWithAnyTokenSwapInfo.ts @@ -9,8 +9,8 @@ export default function useDerivedPayWithAnyTokenSwapInfo( parsedOutputAmount?: CurrencyAmount ): { state: TradeState - trade: InterfaceTrade | undefined - maximumAmountIn: CurrencyAmount | undefined + trade?: InterfaceTrade + maximumAmountIn?: CurrencyAmount allowedSlippage: Percent } { const { state, trade } = useBestTrade(TradeType.EXACT_OUTPUT, parsedOutputAmount, inputCurrency ?? undefined) diff --git a/src/nft/hooks/useTokenInput.ts b/src/nft/hooks/useTokenInput.ts index 9247cd0589..fcef9d580c 100644 --- a/src/nft/hooks/useTokenInput.ts +++ b/src/nft/hooks/useTokenInput.ts @@ -4,10 +4,10 @@ import { create } from 'zustand' import { devtools } from 'zustand/middleware' interface TokenInputState { - inputCurrency: Currency | undefined + inputCurrency?: Currency setInputCurrency: (currency: Currency | undefined) => void clearInputCurrency: () => void - tokenTradeInput: TokenTradeInput | undefined + tokenTradeInput?: TokenTradeInput setTokenTradeInput: (tokenTradeInput: TokenTradeInput | undefined) => void } diff --git a/src/nft/hooks/useWalletBalance.ts b/src/nft/hooks/useWalletBalance.ts index 33b8c8ab5a..c50b53ccb1 100644 --- a/src/nft/hooks/useWalletBalance.ts +++ b/src/nft/hooks/useWalletBalance.ts @@ -8,7 +8,7 @@ interface WalletBalanceProps { address: string balance: string weiBalance: BigNumber - provider: Web3Provider | undefined + provider?: Web3Provider } export function useWalletBalance(): WalletBalanceProps { diff --git a/src/nft/types/sell/sell.ts b/src/nft/types/sell/sell.ts index 76fa7c9d10..b9e9b7220f 100644 --- a/src/nft/types/sell/sell.ts +++ b/src/nft/types/sell/sell.ts @@ -88,7 +88,7 @@ export enum ListingStatus { } export interface AssetRow { - image: string | undefined + image?: string name?: string status: ListingStatus marketplace: ListingMarket diff --git a/src/nft/utils/tokenRoutes.ts b/src/nft/utils/tokenRoutes.ts index 60a0f4da21..35133d9f1d 100644 --- a/src/nft/utils/tokenRoutes.ts +++ b/src/nft/utils/tokenRoutes.ts @@ -109,9 +109,9 @@ function buildTradeRouteInput(swap: Swap): TokenTradeRouteInput { } export function buildAllTradeRouteInputs(trade: InterfaceTrade): { - mixedTokenTradeRouteInputs: TokenTradeRouteInput[] | undefined - v2TokenTradeRouteInputs: TokenTradeRouteInput[] | undefined - v3TokenTradeRouteInputs: TokenTradeRouteInput[] | undefined + mixedTokenTradeRouteInputs?: TokenTradeRouteInput[] + v2TokenTradeRouteInputs?: TokenTradeRouteInput[] + v3TokenTradeRouteInputs?: TokenTradeRouteInput[] } { const mixedTokenTradeRouteInputs: TokenTradeRouteInput[] = [] const v2TokenTradeRouteInputs: TokenTradeRouteInput[] = [] diff --git a/src/pages/CreateProposal/ProposalActionDetail.tsx b/src/pages/CreateProposal/ProposalActionDetail.tsx index 5e8679bca2..bfc7e2c8fd 100644 --- a/src/pages/CreateProposal/ProposalActionDetail.tsx +++ b/src/pages/CreateProposal/ProposalActionDetail.tsx @@ -31,7 +31,7 @@ export const ProposalActionDetail = ({ }: { className?: string proposalAction: ProposalAction - currency: Currency | undefined + currency?: Currency amount: string toAddress: string onCurrencySelect: (currency: Currency) => void diff --git a/src/pages/CreateProposal/ProposalSubmissionModal.tsx b/src/pages/CreateProposal/ProposalSubmissionModal.tsx index 251df89f9b..5833e4fc4a 100644 --- a/src/pages/CreateProposal/ProposalSubmissionModal.tsx +++ b/src/pages/CreateProposal/ProposalSubmissionModal.tsx @@ -15,7 +15,7 @@ export const ProposalSubmissionModal = ({ onDismiss, }: { isOpen: boolean - hash: string | undefined + hash?: string onDismiss: () => void }) => { const theme = useTheme() diff --git a/src/pages/Swap/index.tsx b/src/pages/Swap/index.tsx index c8ce558558..8b6b9f72d4 100644 --- a/src/pages/Swap/index.tsx +++ b/src/pages/Swap/index.tsx @@ -172,7 +172,7 @@ export function Swap({ }: { className?: string prefilledState?: Partial - chainId: SupportedChainId | undefined + chainId?: SupportedChainId onCurrencyChange?: (selected: Pick) => void disableTokenInputs?: boolean }) { @@ -334,10 +334,10 @@ export function Swap({ // modal and loading const [{ showConfirm, tradeToConfirm, swapErrorMessage, attemptingTxn, txHash }, setSwapState] = useState<{ showConfirm: boolean - tradeToConfirm: InterfaceTrade | undefined + tradeToConfirm?: InterfaceTrade attemptingTxn: boolean - swapErrorMessage: string | undefined - txHash: string | undefined + swapErrorMessage?: string + txHash?: string }>({ showConfirm: false, tradeToConfirm: undefined, diff --git a/src/state/connection/reducer.ts b/src/state/connection/reducer.ts index 2786f11d1f..c3f56cd4a0 100644 --- a/src/state/connection/reducer.ts +++ b/src/state/connection/reducer.ts @@ -22,7 +22,7 @@ const connectionSlice = createSlice({ reducers: { updateConnectionError( state, - { payload: { connectionType, error } }: { payload: { connectionType: ConnectionType; error: string | undefined } } + { payload: { connectionType, error } }: { payload: { connectionType: ConnectionType; error?: string } } ) { state.errorByConnectionType[connectionType] = error }, diff --git a/src/state/governance/hooks.ts b/src/state/governance/hooks.ts index 14dfe54026..c679ed09f0 100644 --- a/src/state/governance/hooks.ts +++ b/src/state/governance/hooks.ts @@ -362,7 +362,7 @@ export function useUserDelegatee(): string { } // gets the users current votes -export function useUserVotes(): { loading: boolean; votes: CurrencyAmount | undefined } { +export function useUserVotes(): { loading: boolean; votes?: CurrencyAmount } { const { account, chainId } = useWeb3React() const uniContract = useUniContract() diff --git a/src/state/logs/hooks.ts b/src/state/logs/hooks.ts index 14794871de..0df6de90b4 100644 --- a/src/state/logs/hooks.ts +++ b/src/state/logs/hooks.ts @@ -21,7 +21,7 @@ enum LogsState { } interface UseLogsResult { - logs: Log[] | undefined + logs?: Log[] state: LogsState } diff --git a/src/state/mint/v3/hooks.tsx b/src/state/mint/v3/hooks.tsx index f7538803e7..79e263c796 100644 --- a/src/state/mint/v3/hooks.tsx +++ b/src/state/mint/v3/hooks.tsx @@ -126,7 +126,7 @@ export function useV3DerivedMintInfo( currencyBalances: { [field in Field]?: CurrencyAmount } dependentField: Field parsedAmounts: { [field in Field]?: CurrencyAmount } - position: Position | undefined + position?: Position noLiquidity?: boolean errorMessage?: ReactNode invalidPool: boolean diff --git a/src/state/stake/hooks.tsx b/src/state/stake/hooks.tsx index d12a2d6d48..c9a4cbc0c5 100644 --- a/src/state/stake/hooks.tsx +++ b/src/state/stake/hooks.tsx @@ -58,7 +58,7 @@ interface StakingInfo { // equivalent to percent of total supply * reward rate rewardRate: CurrencyAmount // when the period ends - periodFinish: Date | undefined + periodFinish?: Date // if pool is active active: boolean // calculates a hypothetical amount of token distributed to the active account per second. diff --git a/src/state/swap/hooks.tsx b/src/state/swap/hooks.tsx index ea172fe76e..184f307211 100644 --- a/src/state/swap/hooks.tsx +++ b/src/state/swap/hooks.tsx @@ -78,7 +78,7 @@ export function useDerivedSwapInfo( ): { currencies: { [field in Field]?: Currency | null } currencyBalances: { [field in Field]?: CurrencyAmount } - parsedAmount: CurrencyAmount | undefined + parsedAmount?: CurrencyAmount inputError?: ReactNode trade: { trade?: InterfaceTrade diff --git a/src/state/swap/reducer.ts b/src/state/swap/reducer.ts index 1f7f69f7bc..37f5aa2164 100644 --- a/src/state/swap/reducer.ts +++ b/src/state/swap/reducer.ts @@ -8,10 +8,10 @@ export interface SwapState { readonly independentField: Field readonly typedValue: string readonly [Field.INPUT]: { - readonly currencyId: string | undefined | null + readonly currencyId?: string | null } readonly [Field.OUTPUT]: { - readonly currencyId: string | undefined | null + readonly currencyId?: string | null } // the typed recipient address or ENS name, or null if swap should go to sender readonly recipient: string | null diff --git a/src/state/user/reducer.ts b/src/state/user/reducer.ts index b96f28ecdc..e5ce22363e 100644 --- a/src/state/user/reducer.ts +++ b/src/state/user/reducer.ts @@ -10,7 +10,7 @@ import { SerializedPair, SerializedToken, SlippageTolerance } from './types' const currentTimestamp = () => new Date().getTime() export interface UserState { - buyFiatFlowCompleted: boolean | undefined + buyFiatFlowCompleted?: boolean selectedWallet?: ConnectionType @@ -53,7 +53,7 @@ export interface UserState { URLWarningVisible: boolean hideUniswapWalletBanner: boolean // undefined means has not gone through A/B split yet - showSurveyPopup: boolean | undefined + showSurveyPopup?: boolean } function pairKey(token0Address: string, token1Address: string) { diff --git a/src/utils/formatNumbers.ts b/src/utils/formatNumbers.ts index d44207f659..fe77299e57 100644 --- a/src/utils/formatNumbers.ts +++ b/src/utils/formatNumbers.ts @@ -24,7 +24,7 @@ export const priceToPreciseFloat = (price: Price | undefined } interface FormatDollarArgs { - num: number | undefined | null + num?: number | null isPrice?: boolean lessPreciseStablecoinValues?: boolean digits?: number diff --git a/src/utils/formatTickPrice.ts b/src/utils/formatTickPrice.ts index 73899adb22..b71ab71d31 100644 --- a/src/utils/formatTickPrice.ts +++ b/src/utils/formatTickPrice.ts @@ -4,7 +4,7 @@ import { Price, Token } from '@uniswap/sdk-core' import { Bound } from '../state/mint/v3/actions' interface FormatTickPriceArgs { - price: Price | undefined + price?: Price atLimit: { [bound in Bound]?: boolean | undefined } direction: Bound placeholder?: string diff --git a/src/utils/loggingFormatters.ts b/src/utils/loggingFormatters.ts index c3ebb6d9e5..4de05d7c76 100644 --- a/src/utils/loggingFormatters.ts +++ b/src/utils/loggingFormatters.ts @@ -57,12 +57,12 @@ export const formatSwapPriceUpdatedEventProperties = ( interface AnalyticsEventProps { trade: InterfaceTrade - hash: string | undefined + hash?: string allowedSlippage: Percent - transactionDeadlineSecondsSinceEpoch: number | undefined + transactionDeadlineSecondsSinceEpoch?: number isAutoSlippage: boolean isAutoRouterApi: boolean - swapQuoteReceivedDate: Date | undefined + swapQuoteReceivedDate?: Date routes: RoutingDiagramEntry[] fiatValueInput?: number fiatValueOutput?: number