[BUG] Typescript error from getColumn.eachCell
See original GitHub issue🐛 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
?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
exceljs giving an error in lines for worksheet.columns = [] array ...
This is a known bug in the exceljs library when used in typescript, you can try this workaround: ... worksheet.columns = [ {...
Read more >exceljs/README.md - UNPKG
This fixes <a href="https://github.com/exceljs/exceljs/issues/1357">[BUG] 4.1.0 causes TypeScript compilation errors - addRows styleOption should be optional? # ...
Read more >Beginner's Guide to exceljs. Handling spreadsheet data in ...
This will throw an error when you are calling it within ... Similar to column, you can iterate over each cell of the...
Read more >Github GitHub - exceljs/exceljs: Excel Workbook Manager
It helps me know what features are desired or what bugs are causing the most pain. ... This should fix [BUG] Typescript error...
Read more >exceljs | Yarn - Package Manager
Fixes [BUG] Errors when opening file in Excel after saving a file with conditional ... getColumn('id'); const nameCol = worksheet. ... getColumn(4).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, there was a typo when copying the code. I checked and my code is like what you posted, and the TS error still shows. I have edited my original post to fix my code snippet.
No problem, glad to have been of help to you.