mirror of
https://github.com/vercel/commerce.git
synced 2025-09-07 16:30:17 +00:00
Updated types
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type {
|
||||
GetAllProductsQuery,
|
||||
GetAllProductsQueryVariables,
|
||||
} from 'lib/bigcommerce/schema'
|
||||
} from '@lib/bigcommerce/schema'
|
||||
import type { RecursivePartial, RecursiveRequired } from '../utils/types'
|
||||
import filterEdges from '../utils/filter-edges'
|
||||
import { productConnectionFragment } from '../fragments/product'
|
||||
@@ -47,12 +47,12 @@ export type ProductEdge = NonNullable<
|
||||
NonNullable<GetAllProductsQuery['site']['products']['edges']>[0]
|
||||
>
|
||||
|
||||
export type Product = ProductEdge
|
||||
|
||||
export type Products = ProductEdge[]
|
||||
export type ProductNode = ProductEdge['node']
|
||||
|
||||
export type GetAllProductsResult<
|
||||
T extends Record<keyof GetAllProductsResult, any[]> = { products: Products }
|
||||
T extends Record<keyof GetAllProductsResult, any[]> = {
|
||||
products: ProductEdge[]
|
||||
}
|
||||
> = T
|
||||
|
||||
const FIELDS = [
|
||||
|
@@ -33,13 +33,13 @@ export const getProductQuery = /* GraphQL */ `
|
||||
${productInfoFragment}
|
||||
`
|
||||
|
||||
export type Product = Extract<
|
||||
export type ProductNode = Extract<
|
||||
GetProductQuery['site']['route']['node'],
|
||||
{ __typename: 'Product' }
|
||||
>
|
||||
|
||||
export type GetProductResult<
|
||||
T extends { product?: any } = { product?: Product }
|
||||
T extends { product?: any } = { product?: ProductNode }
|
||||
> = T
|
||||
|
||||
export type ProductVariables = Images &
|
||||
|
Reference in New Issue
Block a user