From 09e1cf2ef2fb3b19bb95e7063347e2fc2e3f634b Mon Sep 17 00:00:00 2001 From: Samantha Kellow Date: Fri, 24 Nov 2023 09:21:59 +0000 Subject: [PATCH] typing --- components/product/variant-details.tsx | 6 +++--- components/product/variant-selector.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/product/variant-details.tsx b/components/product/variant-details.tsx index d77a0bf57..e98f3e5a7 100644 --- a/components/product/variant-details.tsx +++ b/components/product/variant-details.tsx @@ -1,20 +1,20 @@ 'use client' import Price from "components/price"; -import { Product } from "lib/shopify/types"; +import { Product, ProductVariant } from "lib/shopify/types"; import { useState } from "react"; import { VariantSelector } from "./variant-selector"; export function VariantDetails({ product }: { product: Product }) { const filterDeterminedOptions = product.options.filter(option => option.name !== 'Wrap'); - const [selectedVariant, setSelectedVariant] = useState(product.variants[0]); + const [selectedVariant, setSelectedVariant] = useState | undefined>(product.variants[0]); return ( <>
diff --git a/components/product/variant-selector.tsx b/components/product/variant-selector.tsx index c2e68e5e7..903e14e21 100644 --- a/components/product/variant-selector.tsx +++ b/components/product/variant-selector.tsx @@ -26,7 +26,7 @@ export function VariantSelector({ }: { options: ProductOption[]; variants: ProductVariant[]; - setSelectedVariant: (newVariant: OptimizedVariant | undefined) => void, + setSelectedVariant: (value: OptimizedVariant | undefined) => void, }) { const pathname = usePathname(); const currentParams = useSearchParams();