resolve type errors

This commit is contained in:
tedraykov 2024-06-20 15:26:59 +03:00
parent bdbf9eca88
commit 3cf2f61e0b
2 changed files with 22 additions and 30 deletions

View File

@ -194,15 +194,15 @@ function OrderDetails({ order }: { order: Order }) {
<Label>Shipping Address</Label>
<div>
<Text>
{order.shippingAddress.firstName} {order.shippingAddress.lastName}
{order.shippingAddress!.firstName} {order.shippingAddress!.lastName}
</Text>
<Text>{order.shippingAddress.address1}</Text>
{order.shippingAddress.address2 && <Text>{order.shippingAddress.address2}</Text>}
<Text>{order.shippingAddress!.address1}</Text>
{order.shippingAddress!.address2 && <Text>{order.shippingAddress!.address2}</Text>}
<Text>
{order.shippingAddress.city} {order.shippingAddress.provinceCode}{' '}
{order.shippingAddress.zip}
{order.shippingAddress!.city} {order.shippingAddress!.provinceCode}{' '}
{order.shippingAddress!.zip}
</Text>
<Text>{order.shippingAddress.country}</Text>
<Text>{order.shippingAddress!.country}</Text>
</div>
</div>
<div className="flex flex-col gap-2">
@ -219,15 +219,15 @@ function OrderDetails({ order }: { order: Order }) {
<Label>Billing Address</Label>
<div>
<Text>
{order.billingAddress.firstName} {order.billingAddress.lastName}
{order.billingAddress!.firstName} {order.billingAddress!.lastName}
</Text>
<Text>{order.billingAddress.address1}</Text>
{order.billingAddress.address2 && <Text>{order.billingAddress.address2}</Text>}
<Text>{order.billingAddress!.address1}</Text>
{order.billingAddress!.address2 && <Text>{order.billingAddress!.address2}</Text>}
<Text>
{order.billingAddress.city} {order.billingAddress.provinceCode}{' '}
{order.billingAddress.zip}
{order.billingAddress!.city} {order.billingAddress!.provinceCode}{' '}
{order.billingAddress!.zip}
</Text>
<Text>{order.billingAddress.country}</Text>
<Text>{order.billingAddress!.country}</Text>
</div>
</div>
</div>
@ -270,8 +270,8 @@ function OrderSummary({ order }: { order: Order }) {
<Text>Subtotal</Text>
<Price
className="text-sm font-semibold"
amount={order.totalPrice.amount}
currencyCode={order.totalPrice.currencyCode}
amount={order.totalPrice!.amount}
currencyCode={order.totalPrice!.currencyCode}
/>
</div>
<div className="flex items-center justify-between">
@ -293,8 +293,8 @@ function OrderSummary({ order }: { order: Order }) {
</Heading>
<Price
className="font-semibold"
amount={order.totalPrice.amount}
currencyCode={order.totalPrice.currencyCode}
amount={order.totalPrice!.amount}
currencyCode={order.totalPrice!.currencyCode}
/>
</div>
</div>

View File

@ -136,13 +136,13 @@ export type Order = {
fulfillments: Fulfillment[];
transactions: Transaction[];
lineItems: LineItem[];
shippingAddress: Address;
billingAddress: Address;
shippingAddress?: Address;
billingAddress?: Address;
/** the price of all line items, excluding taxes and surcharges */
subtotal: Money;
totalShipping: Money;
totalTax: Money;
totalPrice: Money;
subtotal?: Money;
totalShipping?: Money;
totalTax?: Money;
totalPrice?: Money;
shippingMethod?: {
name: string;
price: Money;
@ -283,14 +283,6 @@ type ShopifyImage = {
width: number;
};
type ShopifyFulfillmentEventConnection = {
edges: ShopifyFulfillmentEventEdge[];
};
type ShopifyFulfillmentEventEdge = {
node: ShopifyFulfillmentEvent;
};
type ShopifyFulfillmentEvent = {
status: string;
happenedAt: string;