import { ProductVariant as ProductVariantEntity, Region, StoreCartsRes, } from "@medusajs/medusa" import { QueryKey, UseQueryOptions } from "react-query" export type UseQueryOptionsWrapper< // Return type of queryFn TQueryFn = unknown, // Type thrown in case the queryFn rejects E = Error, // Query key type TQueryKey extends QueryKey = QueryKey > = Omit< UseQueryOptions, "queryKey" | "queryFn" | "select" | "refetchInterval" > // Choose only a subset of the type Region to allow for some flexibility export type RegionInfo = Pick export type ProductVariant = ConvertDateToString< Omit > export type ProductVariantInfo = Pick type ConvertDateToString = { [P in keyof T]: T[P] extends Date ? Date | string : T[P] } export type Cart = StoreCartsRes["cart"] export type TQueryKey = { all: [TKey] lists: () => [...TQueryKey["all"], "list"] list: ( query?: TListQuery ) => [ ...ReturnType["lists"]>, { query: TListQuery | undefined } ] details: () => [...TQueryKey["all"], "detail"] detail: ( id: TDetailQuery ) => [...ReturnType["details"]>, TDetailQuery] }