bigcommerce / nextjs-commerce

Next.js Commerce
https://next-commerce-v2.vercel.app
MIT License
92 stars 81 forks source link

Set productEntityId as undefined in CartCustomItem type #5

Closed becomevocal closed 1 year ago

becomevocal commented 1 year ago

This resolves the following issue on build:

Screenshot 2023-06-01 at 4 51 41 PM

The reason it failed is because productEntityId doesn't exist on the CartCustomItem type and Typescript can't access properties it doesn't know about, so it errors out on the deconstruction of productEntityId even though the other type in the union has it.

By adding the property as undefined on the CartCustomItem type, this issue is resolved without changing the cart mapper logic and respecting the rest of the typings.

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nextjs-commerce ✅ Ready (Inspect) Visit Preview Jun 1, 2023 9:06pm