Shopify / hydrogen

Hydrogen lets you build faster headless storefronts in less time, on Shopify.
https://hydrogen.shop
MIT License
1.44k stars 273 forks source link

Preferences missing from CartBuyerIdentityInput type #2288

Closed diced-dev closed 4 months ago

diced-dev commented 4 months ago

What is the location of your example repository?

No response

Which package or tool is having this issue?

Hydrogen

What version of that package or tool are you using?

2024.4.0

What version of Remix are you using?

2.8.0

Steps to Reproduce

Attempt to define preferences for the buyerIdentity object param of the Hydrogen Cart updateBuyerIdentity method in IDE (VS Code). The reported typescript error should be shown.

Expected Behavior

preferences exists on the Storefront 2024-04 CartBuyerIdentityInput input object. https://shopify.dev/docs/api/storefront/2024-04/input-objects/CartBuyerIdentityInput

I should be able to set the value of preferences on buyer identity via the Hydrogen Cart updateBuyerIdentity method without getting typescript errors that preferences does not exist on the type.

Actual Behavior

I get the following error when trying to define preferences:

Object literal may only specify known properties, and 'preferences' does not exist in type 'CartBuyerIdentityInput'.ts (2353)

image

image

Checking the storefront-api-types.d.ts file there is no preferences on CartBuyerIdentityInput.

michenly commented 4 months ago

I am not sure why the doc for 2024-04 is using preferences where the generated schema is listing walletPreferences but this will be fix with 2024-07 when it is release next week. Would that be sufficient?

diced-dev commented 4 months ago

That sounds great, thanks @michenly 👍

I've augmented the types to add support for this in the meantime in our project, so will remove once this has been released.

michenly commented 4 months ago

@diced-dev Hydrogen v2024-07 is release and the type is sync up now. doc: https://shopify.dev/docs/api/storefront/2024-07/input-objects/CartBuyerIdentityInput#field-preferences type: https://github.com/Shopify/hydrogen/blob/main/packages/hydrogen-react/src/storefront-api-types.d.ts#L733