Skip to content

[BUG] Typescript error from getColumn.eachCell #1120

Closed
@weelillad

Description

@weelillad

🐛 Bug Report

Typescript error when using Worksheet.getColumn().eachCell - TS2722: Cannot invoke an object which is possibly 'undefined'.

Lib version: 3.8.0

Steps To Reproduce

Code example

const wb = new ExcelJS.Workbook();
const ws = wb.addWorksheet('XYZ');
...
ws.getColumn(1).eachCell((cell, rowNum) => {
  cell.fill = headerFill;
});

The expected behaviour:

There should be no error.

Possible solution (optional, but very helpful):

Is it possible to clearly define the functions and properties that are available from getColumn?

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