chore(medusa-core-utils): Migrate to TS (#2670)

This commit is contained in:
Adrien de Peretti
2022-12-05 10:21:04 +01:00
committed by GitHub
parent 1dc816039c
commit 1b21af87ab
23 changed files with 254 additions and 233 deletions
@@ -1,23 +1,23 @@
import { EntityManager } from "typeorm"
import { MedusaError, computerizeAmount } from "medusa-core-utils"
import { computerizeAmount, MedusaError } from "medusa-core-utils"
import { AbstractBatchJobStrategy, IFileService } from "../../../interfaces"
import CsvParser from "../../../services/csv-parser"
import {
BatchJobService,
ProductVariantService,
PriceListService,
ProductVariantService,
RegionService,
} from "../../../services"
import { CreateBatchJobInput } from "../../../types/batch-job"
import {
InjectedProps,
OperationType,
PriceListImportOperation,
PriceListImportOperationPrice,
ParsedPriceListImportPrice,
PriceListImportBatchJob,
PriceListImportCsvSchema,
PriceListImportOperation,
PriceListImportOperationPrice,
TBuiltPriceListImportLine,
TParsedPriceListImportRowData,
} from "./types"
@@ -204,7 +204,10 @@ class PriceListImportStrategy extends AbstractBatchJobStrategy {
record.currency_code = price.currency_code
}
record.amount = computerizeAmount(record.amount, record.currency_code)
record.amount = computerizeAmount(
record.amount as number,
record.currency_code
)
operationalPrices.push(record as PriceListImportOperationPrice)
}
@@ -218,7 +218,10 @@ class ProductImportStrategy extends AbstractBatchJobStrategy {
record.currency_code = price.currency_code
}
record.amount = computerizeAmount(record.amount, record.currency_code)
record.amount = computerizeAmount(
Number(record.amount),
record.currency_code as string
)
prices.push(record)
}