From 573fad6fb0448cc79f55096cbd7ae70a6abe5a96 Mon Sep 17 00:00:00 2001 From: Helen Lin Date: Mon, 28 Nov 2022 13:04:04 -0800 Subject: [PATCH] Fix duplicated names (#250) --- templates/demo-store/app/components/Cart.tsx | 10 +++++----- .../app/routes/products/$productHandle.tsx | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/templates/demo-store/app/components/Cart.tsx b/templates/demo-store/app/components/Cart.tsx index 529d556a97..a92f5c7d14 100644 --- a/templates/demo-store/app/components/Cart.tsx +++ b/templates/demo-store/app/components/Cart.tsx @@ -5,7 +5,7 @@ import {flattenConnection, Image, Money} from '@shopify/hydrogen-react'; import {Button, Heading, IconRemove, Text, Link} from '~/components'; import {getInputStyleClasses} from '~/lib/utils'; import type { - Cart, + Cart as CartType, CartCost, CartLine, } from '@shopify/hydrogen-react/storefront-api-types'; @@ -38,7 +38,7 @@ export function Cart({ }: { layout: Layouts; onClose?: () => void; - cart: Cart | null; + cart: CartType | null; }) { const linesCount = cart?.lines?.edges?.length || 0; const {linesAdding} = useCartLinesAdding(); @@ -64,7 +64,7 @@ export function CartDetails({ cart, }: { layout: Layouts; - cart: Cart | null; + cart: CartType | null; }) { // @todo: get optimistic cart cost const isZeroCost = !cart || cart?.cost?.subtotalAmount?.amount === '0.0'; @@ -95,7 +95,7 @@ export function CartDetails({ function CartDiscounts({ discountCodes, }: { - discountCodes: Cart['discountCodes']; + discountCodes: CartType['discountCodes']; }) { const {discountCodesUpdating} = useCartDiscountCodesUpdating(); const [hovered, setHovered] = useState(false); @@ -165,7 +165,7 @@ function CartLines({ lines: cartLines, }: { layout: Layouts; - lines: Cart['lines'] | undefined; + lines: CartType['lines'] | undefined; }) { const currentLines = cartLines ? flattenConnection(cartLines) : []; const {optimisticLinesNew} = useOptimisticCartLinesAdding(currentLines); diff --git a/templates/demo-store/app/routes/products/$productHandle.tsx b/templates/demo-store/app/routes/products/$productHandle.tsx index eb0c25b9f6..df22c3f96a 100644 --- a/templates/demo-store/app/routes/products/$productHandle.tsx +++ b/templates/demo-store/app/routes/products/$productHandle.tsx @@ -25,10 +25,10 @@ import { import {getExcerpt, variantToCartLine} from '~/lib/utils'; import invariant from 'tiny-invariant'; import clsx from 'clsx'; -import { +import type { ProductVariant, SelectedOptionInput, - Product, + Product as ProductType, Shop, ProductConnection, } from '@shopify/hydrogen-react/storefront-api-types'; @@ -55,7 +55,7 @@ export async function loader({ }); const {shop, product} = await storefront.query<{ - product: Product & {selectedVariant?: ProductVariant}; + product: ProductType & {selectedVariant?: ProductVariant}; shop: Shop; }>(PRODUCT_QUERY, { variables: { @@ -215,7 +215,7 @@ function ProductOptions({ options, searchParamsWithDefaults, }: { - options: Product['options']; + options: ProductType['options']; searchParamsWithDefaults: URLSearchParams; }) { const closeRef = useRef(null); @@ -572,7 +572,7 @@ async function getRecommendedProducts( productId: string, ) { const products = await storefront.query<{ - recommended: Product[]; + recommended: ProductType[]; additional: ProductConnection; }>(RECOMMENDED_PRODUCTS_QUERY, { variables: {productId, count: 12}, @@ -588,7 +588,7 @@ async function getRecommendedProducts( ); const originalProduct = mergedProducts - .map((item: Product) => item.id) + .map((item: ProductType) => item.id) .indexOf(productId); mergedProducts.splice(originalProduct, 1);