diff --git a/furniture-3d-system/src/lib/non-integrated-sku-export.ts b/furniture-3d-system/src/lib/non-integrated-sku-export.ts index f75a8af6..60a20baa 100644 --- a/furniture-3d-system/src/lib/non-integrated-sku-export.ts +++ b/furniture-3d-system/src/lib/non-integrated-sku-export.ts @@ -24,12 +24,15 @@ export type NonIntegratedSkuExportRow = { batchNo: string batchChangeType: string dingTalkFlowNo: string - rowNumber?: number +} + +export type NonIntegratedSkuImportRow = NonIntegratedSkuExportRow & { + rowNumber: number } export function findSkuImportSpuPrefixErrors( rows: ReadonlyArray< - Pick & { rowNumber?: number } + Pick >, spu: string, ) { @@ -65,7 +68,7 @@ export type NonIntegratedSkuFuzzyImportRow = { export type NonIntegratedSkuWorkbookImport = | { mode: "standard" - rows: NonIntegratedSkuExportRow[] + rows: NonIntegratedSkuImportRow[] sheetName: string } | { @@ -389,7 +392,7 @@ export async function parseNonIntegratedSkuWorkbook( if (missingLabels.length === 0) { const rows = sheetRows .slice(headerRowIndex + 1) - .map((row, index) => { + .map((row, index): NonIntegratedSkuImportRow => { const importRow = createEmptyImportRow() for (const column of NON_INTEGRATED_SKU_TEMPLATE_COLUMNS) { const cellIndex = headerIndexByLabel.get(column.label) @@ -398,8 +401,7 @@ export async function parseNonIntegratedSkuWorkbook( ? '' : normalizeWorkbookCellValue(row[cellIndex]) } - importRow.rowNumber = headerRowIndex + index + 2 - return importRow + return { ...importRow, rowNumber: headerRowIndex + index + 2 } }) .filter((row) => NON_INTEGRATED_SKU_TEMPLATE_COLUMNS.some(