Fixed types

This commit is contained in:
Luis Alvarez
2021-02-25 17:18:50 -05:00
parent 46ae76c67f
commit e90d9a2121
9 changed files with 28 additions and 23 deletions

View File

@@ -40,7 +40,8 @@ export const handler: MutationHook<Cart, {}, CartItemBody> = {
},
})
return checkoutToCart(checkoutLineItemsAdd)
// TODO: Fix this Cart type here
return checkoutToCart(checkoutLineItemsAdd) as any
},
useHook: ({ fetch }) => () => {
const { mutate } = useCart()

View File

@@ -1,6 +1,4 @@
import { useMemo } from 'react'
import type { ShopifyProvider } from '..'
import useCommerceCart, {
FetchCartInput,
UseCart,
@@ -11,7 +9,7 @@ import { SWRHook } from '@commerce/utils/types'
import { checkoutCreate, checkoutToCart } from './utils'
import getCheckoutQuery from '../utils/queries/get-checkout-query'
export default useCommerceCart as UseCart<ShopifyProvider>
export default useCommerceCart as UseCart<typeof handler>
export const handler: SWRHook<
Cart | null,
@@ -38,7 +36,8 @@ export const handler: SWRHook<
checkout = await checkoutCreate(fetch)
}
return checkoutToCart({ checkout })
// TODO: Fix this type
return checkoutToCart({ checkout } as any)
},
useHook: ({ useData }) => (input) => {
const response = useData({

View File

@@ -24,7 +24,8 @@ const fetcher: HookFetcherFn<Cart | null, FetchCartInput> = async ({
checkout = await checkoutCreate(fetch)
}
return checkoutToCart({ checkout })
// TODO: Fix this type
return checkoutToCart({ checkout } as any)
}
export default fetcher