updated useCart types

This commit is contained in:
Luis Alvarez 2021-01-26 17:10:33 -05:00
parent 7edd5aa182
commit 61fa423673
2 changed files with 4 additions and 3 deletions

View File

@ -6,10 +6,10 @@ import { useCommerce } from '..'
export type CartResponse<Data> = ResponseState<Data> & { isEmpty?: boolean }
export type CartInput = {
cartId: Cart['id']
cartId?: BaseCart['id']
}
export default function useCart<Data>(
export default function useCart<Data extends BaseCart | null>(
options: HookFetcherOptions,
input: HookInput,
fetcherFn: HookFetcher<Data, CartInput>,

View File

@ -127,7 +127,8 @@ interface BaseCart {
discounts?: DiscountBase[]
}
interface Cart extends Entity {
// TODO: Remove this type in favor of BaseCart
interface Cart2 extends Entity {
id: string | undefined
currency: { code: string }
taxIncluded?: boolean