Skip to content

product_data metadata typescript #342

Open
@bfourgeaud

Description

Hello,

Does anyone have an idea how to augment the ProductAttributes.product_data interface in order to type the product metadata ?
I need this in order to handle my product variations, and handle subsequent api calls.

I tried creating a shoppingCart.d.ts file but it doesn not work. The interface seems not to be augmentable ...

import "use-shopping-cart"

declare module "use-shopping-cart" {
  interface ProductAttributes {
    product_data: {
      type: "MULTI" | "SINGLE"
      barcode?: string
      options?: string[]
      productId: string
      variantId?: string
    }
  }
}

This causes typescript to show errors when I try to access the item metadata
image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions