Skip to content

Commit

Permalink
exact types
Browse files Browse the repository at this point in the history
  • Loading branch information
tlgimenes committed Jun 9, 2022
1 parent 4da4baf commit e931035
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/api/src/platforms/vtex/resolvers/aggregateOffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ export const StoreAggregateOffer: Record<string, Resolver<Root>> & {
} = {
highPrice: (offers) => {
const availableOffers = offers.filter(inStock)
const highOffer = availableOffers[availableOffers.length - 1]

return price(availableOffers[availableOffers.length - 1]) ?? 0
return highOffer != null ? price(highOffer) : 0
},
lowPrice: (offers) => {
const availableOffers = offers.filter(inStock)
const [lowOffer] = offers.filter(inStock)

return price(availableOffers[0]) ?? 0
return lowOffer ? price(lowOffer) : 0
},
offerCount: (offers) => offers.length,
priceCurrency: () => '',
Expand Down

0 comments on commit e931035

Please sign in to comment.