Fixed types

This commit is contained in:
Luis Alvarez
2021-02-25 17:18:50 -05:00
parent 46ae76c67f
commit e90d9a2121
9 changed files with 28 additions and 23 deletions

View File

@@ -1,4 +1,8 @@
import { Product, Image } from '../types'
// TODO: Fix the types in this file
// import { Product, Image } from '../types'
type Product = any
type Image = any
export default function toCommerceProducts(products: Product[]) {
return products.map((product: Product) => {
@@ -20,10 +24,12 @@ export default function toCommerceProducts(products: Product[]) {
url: image.src,
}
}),
variants: product.variants.map((variant) => {
// TODO: Fix the variant type
variants: product.variants.map((variant: any) => {
return {
id: variant.id,
options: variant.selectedOptions.map((selectedOption) => {
// TODO: Fix the selectedOption type
options: variant.selectedOptions.map((selectedOption: any) => {
return {
__typename: 'MultipleChoiceOption',
displayName: selectedOption.name,
@@ -39,11 +45,13 @@ export default function toCommerceProducts(products: Product[]) {
}),
}
}),
productOptions: product.options.map((option) => {
// TODO: Fix the option type
productOptions: product.options.map((option: any) => {
return {
__typename: 'MultipleChoiceOption',
displayName: option.name,
values: option.values.map((value) => {
// TODO: Fix the value type
values: option.values.map((value: any) => {
return {
node: {
entityId: 1,