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.
This resolves the following issue on build:
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.