From d9243880a3c81c65defa7f4699033cb0ed0c7439 Mon Sep 17 00:00:00 2001 From: Luis Alvarez <luis@vercel.com> Date: Sun, 14 Feb 2021 18:40:48 -0500 Subject: [PATCH] Fixed some types --- components/cart/CartItem/CartItem.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/components/cart/CartItem/CartItem.tsx b/components/cart/CartItem/CartItem.tsx index 87fb86d0b..bb57c3f25 100644 --- a/components/cart/CartItem/CartItem.tsx +++ b/components/cart/CartItem/CartItem.tsx @@ -75,6 +75,8 @@ const CartItem = ({ setRemoving(false) } } + // TODO: Add a type for this + const options = (item as any).options useEffect(() => { // Reset the quantity state if the item quantity changes @@ -95,8 +97,8 @@ const CartItem = ({ className={s.productImage} width={150} height={150} - src={item.variant.image.url} - alt={item.variant.image.altText} + src={item.variant.image!.url} + alt={item.variant.image!.altText} unoptimized /> </div> @@ -109,15 +111,15 @@ const CartItem = ({ {item.name} </span> </Link> - {item.options && item.options.length > 0 ? ( + {options && options.length > 0 ? ( <div className=""> - {item.options.map((option: ItemOption, i: number) => ( + {options.map((option: ItemOption, i: number) => ( <span key={`${item.id}-${option.name}`} className="text-sm font-semibold text-accents-7" > {option.value} - {i === item.options.length - 1 ? '' : ', '} + {i === options.length - 1 ? '' : ', '} </span> ))} </div>