From 8fe1e913fec6f44e66f6e13f93bf05e15ce29375 Mon Sep 17 00:00:00 2001 From: Georgios Botzakis <45125702+GeorgeBotzakis@users.noreply.github.com> Date: Fri, 9 Feb 2024 17:49:58 +0000 Subject: [PATCH] fix: Variation & variation option update body type (#913) * 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 --- src/types/pcm-variations.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/types/pcm-variations.ts b/src/types/pcm-variations.ts index c1a1fe8d4..d3970f69f 100644 --- a/src/types/pcm-variations.ts +++ b/src/types/pcm-variations.ts @@ -29,8 +29,11 @@ export interface PCMVariation extends Identifiable, PCMVariationBase { } } -export interface UpdateVariationBody extends PCMVariationBase, Identifiable { - attributes: PCMVariationBase['attributes'] & { +export interface UpdateVariationBody + extends Omit, + Identifiable { + attributes: { + name: string sort_order?: number | null } } @@ -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 @@ -50,6 +52,7 @@ export interface PCMVariationOptionBase { export interface PCMVariationOption extends Identifiable, PCMVariationOptionBase { + type: 'product-variation-option' meta: { owner?: 'organization' | 'store' modifiers?: VariationsModifierTypeObj[] @@ -57,10 +60,11 @@ export interface PCMVariationOption } export interface UpdateVariationOptionBody - extends PCMVariationOptionBase, + extends Omit, Identifiable { - type: 'product-variation-option' - attributes: PCMVariationOptionBase['attributes'] & { + attributes: { + name: string + description: string sort_order?: number | null } }