Skip to content

Commit

Permalink
fix: Types issues
Browse files Browse the repository at this point in the history
  • Loading branch information
acasazza committed Feb 23, 2022
1 parent 8d2416f commit df0da67
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
5 changes: 2 additions & 3 deletions src/components/AvailabilityContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import availabilityReducer, {
getAvailability,
} from '#reducers/AvailabilityReducer'
import AvailabilityContext from '#context/AvailabilityContext'
import { isEmpty } from 'lodash'
import ItemContext from '#context/ItemContext'
import getCurrentItemKey from '#utils/getCurrentItemKey'
import components from '#config/components'
Expand Down Expand Up @@ -48,8 +47,8 @@ const AvailabilityContainer: FunctionComponent<AvailabilityContainerProps> = (
delivery_lead_times: [],
},
]
if (!isEmpty(level) && level?.delivery_lead_times?.length > 0) {
const [delivery] = level?.delivery_lead_times
if (level !== undefined && level?.delivery_lead_times?.length > 0) {
const [delivery] = level.delivery_lead_times
dispatch({
type: 'setAvailability',
payload: { ...delivery, quantity: level?.quantity },
Expand Down
4 changes: 2 additions & 2 deletions src/components/PaymentSourceBrandIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import PaymentSourceContext, { iconBrand } from '#context/PaymentSourceContext'
import PaymentSourceContext, { IconBrand } from '#context/PaymentSourceContext'
import React, { FunctionComponent, useContext, useRef } from 'react'
import Parent from './utils/Parent'
import { FunctionChildren } from '#typings'
Expand All @@ -9,7 +9,7 @@ const displayName = components.PaymentSourceBrandIcon.displayName

type CustomComponent = FunctionChildren<
Omit<
Props & { brand: iconBrand; defaultSrc: string; url: string },
Props & { brand: IconBrand; defaultSrc: string; url: string },
'children'
>
>
Expand Down
4 changes: 2 additions & 2 deletions src/components/PaymentSourceBrandName.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import PaymentSourceContext, { iconBrand } from '#context/PaymentSourceContext'
import PaymentSourceContext, { IconBrand } from '#context/PaymentSourceContext'
import { capitalize } from 'lodash'
import React, { FunctionComponent, useContext } from 'react'
import Parent from './utils/Parent'
Expand All @@ -9,7 +9,7 @@ const propTypes = components.PaymentSourceBrandName.propTypes
const displayName = components.PaymentSourceBrandName.displayName

type CustomComponent = FunctionChildren<
Omit<Props & { brand: iconBrand }, 'children'>
Omit<Props & { brand: IconBrand }, 'children'>
>

type Props = {
Expand Down
4 changes: 2 additions & 2 deletions src/components/utils/PaymentCardsTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
PaymentResource,
PaymentSourceType,
} from '#reducers/PaymentMethodReducer'
import PaymentSourceContext, { iconBrand } from '#context/PaymentSourceContext'
import PaymentSourceContext, { IconBrand } from '#context/PaymentSourceContext'
import { FunctionChildren } from '#typings'
import getCardDetails from '#utils/getCardDetails'

Expand All @@ -15,7 +15,7 @@ type ChildrenProps = Pick<Props, 'customerPayments'> & {

type CustomerPayment = PaymentSourceType & {
card?: {
brand?: iconBrand
brand?: IconBrand
last4?: string
}
handleClick?: () => void
Expand Down
8 changes: 5 additions & 3 deletions src/context/OrderContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
type DefaultContext = {
createOrder: CreateOrder
addToCart: AddToCart
setOrderErrors: typeof setOrderErrors
setOrderErrors: (errors: unknown) => void
setGiftCardOrCouponCode: SetGiftCardOrCouponCode
removeGiftCardOrCouponCode: RemoveGiftCardOrCouponCode
saveAddressToCustomerAddressBook: SaveAddressToCustomerAddressBook
Expand All @@ -32,12 +32,14 @@ type DefaultContext = {
export const defaultOrderContext = {
addToCart,
createOrder,
setOrderErrors,
setOrderErrors: () => {
return
},
setGiftCardOrCouponCode,
removeGiftCardOrCouponCode,
saveAddressToCustomerAddressBook,
addResourceToInclude,
getOrder: async (_id: string) => {
getOrder: async () => {
return
},
updateOrder,
Expand Down

0 comments on commit df0da67

Please sign in to comment.