Skip to content

[BUG] Typescript types not support worksheet.model.merges #1341

@qmhc

Description

@qmhc

🐛 Bug Report

Lib version: 4.0.1

Steps To Reproduce

Get a error when clone worksheet with using typescript.

const tempSheet = tempWorkbook.getWorksheet('template')
const clonedSheet = parentWorkbook.addWorksheet('sheet')

clonedSheet.model = Object.assign(tempSheet.model, {
  mergeCells: tempSheet.model.merges
})
clonedSheet.name = `a-unique-name`
clonedSheet.eachRow(row => {
  row.eachCell(cell => {
    if (cell.master !== cell) {
      cell.style = cell.master.style
    }
  })
})

The expected behaviour:

image

I must use @ts-ignore to disable the error.

clonedSheet.model = Object.assign(tempSheet.model, {
  /* @ts-ignore */
  mergeCells: tempSheet.model.merges
})

I think that isn't consistent for using typescript.

Is't possible to add merges property to WorksheetModel interface?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions