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

Commit

Permalink
fix: define variable for codec with only product as attr
Browse files Browse the repository at this point in the history
  • Loading branch information
justinemmanuelmercado committed May 28, 2020
1 parent 9dff55d commit 4997e5f
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/sections/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ interface ListMatchingProductsRequestParameters {

const Product = record(string, unknown)

const SingleProductCodec = Codec.interface({
Product,
})

const ListMatchingProducts = Codec.interface({
Products: ensureArray('Product', Product),
})
Expand All @@ -174,12 +178,7 @@ interface GetMatchingProductParameters {
[key: string]: string[] | string
}

const GetMatchingProductResult = ensureArray(
'GetMatchingProductResult',
Codec.interface({
Product,
}),
)
const GetMatchingProductResult = ensureArray('GetMatchingProductResult', SingleProductCodec)

const GetMatchingProductResponse = Codec.interface({
GetMatchingProductResponse: GetMatchingProductResult,
Expand Down Expand Up @@ -217,9 +216,7 @@ interface GetCompetitivePricingForSkuParameters {

const GetCompetitivePricingForSKUResult = ensureArray(
'GetCompetitivePricingForSKUResult',
Codec.interface({
Product,
}),
SingleProductCodec,
)

type GetCompetitivePricingForSKUResult = GetInterface<typeof GetCompetitivePricingForSKUResult>
Expand All @@ -230,9 +227,7 @@ const GetCompetitivePricingForSKUResponse = Codec.interface({

const GetCompetitivePricingForASINResult = ensureArray(
'GetCompetitivePricingForASINResult',
Codec.interface({
Product,
}),
SingleProductCodec,
)

type GetCompetitivePricingForASINResult = GetInterface<typeof GetCompetitivePricingForASINResult>
Expand Down

0 comments on commit 4997e5f

Please sign in to comment.