Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
fix: Variation & variation option update body type (#913)
Browse files Browse the repository at this point in the history
* fix: variation option base type correction and fixed inaccurate update body type for variation and variation option

* fix: changed update body types using intersection instead of mapped type

* fix: removed intermediate attributes type
  • Loading branch information
GeorgeBotzakis authored Feb 9, 2024
1 parent e3c756c commit 8fe1e91
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/types/pcm-variations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ export interface PCMVariation extends Identifiable, PCMVariationBase {
}
}

export interface UpdateVariationBody extends PCMVariationBase, Identifiable {
attributes: PCMVariationBase['attributes'] & {
export interface UpdateVariationBody
extends Omit<PCMVariationBase, 'attributes'>,
Identifiable {
attributes: {
name: string
sort_order?: number | null
}
}
Expand All @@ -39,7 +42,6 @@ export interface UpdateVariationBody extends PCMVariationBase, Identifiable {
* Product variation option base interface
*/
export interface PCMVariationOptionBase {
type: 'product-variation-option'
attributes: {
name: string
description: string
Expand All @@ -50,17 +52,19 @@ export interface PCMVariationOptionBase {
export interface PCMVariationOption
extends Identifiable,
PCMVariationOptionBase {
type: 'product-variation-option'
meta: {
owner?: 'organization' | 'store'
modifiers?: VariationsModifierTypeObj[]
}
}

export interface UpdateVariationOptionBody
extends PCMVariationOptionBase,
extends Omit<PCMVariationOptionBase, 'attributes'>,
Identifiable {
type: 'product-variation-option'
attributes: PCMVariationOptionBase['attributes'] & {
attributes: {
name: string
description: string
sort_order?: number | null
}
}
Expand Down

0 comments on commit 8fe1e91

Please sign in to comment.