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

View File

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