question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] `addRow` and `addRows` types broken in 4.1.0

See original GitHub issue

🐛 Bug Report

v4.1.0 of the library broke the [TypeScript] types of addRow and addRows by requiring a second argument (styleOption). This is however an optional argument.

Lib version: 4.1.0

Steps To Reproduce

const wb = new ExcelJS.Workbook();
const ws = wb.addWorksheet('blort');

ws.addRow([1]); // type error

The expected behaviour:

There should be no compilationn error, since the second argument is optional.

Possible solution (optional, but very helpful):

--- a/node_modules/exceljs/index.d.ts
+++ b/node_modules/exceljs/index.d.ts
@@ -1193,12 +1193,12 @@ export interface Worksheet {
 	 * Add a couple of Rows by key-value, after the last current row, using the column keys,
 	 * or add a row by contiguous Array (assign to columns A, B & C)
 	 */
-	addRow(data: any[] | any, styleOption: string): Row;
+	addRow(data: any[] | any, styleOption?: string): Row;

 	/**
 	 * Add multiple rows by providing an array of arrays or key-value pairs
 	 */
-	addRows(rows: any[], styleOption: string): void;
+	addRows(rows: any[], styleOption?: string): void;

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
alubbecommented, Jul 9, 2020

@guyonroche would you do the honours?

2reactions
bengrycommented, Jul 20, 2020

Looks to be fixed in 4.1.1. Closing. Thanks to everyone involved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

APEX 4.1 : Problem with addRow Function — oracle-tech
The problem is that I Create a button called " Add Row" and into it I paste the ... When I run the...
Read more >
exceljs - npm
Excel Workbook Manager - Read and Write xlsx and csv Files.. Latest version: 4.3.0, last published: a year ago. Start using exceljs in...
Read more >
Add row in each group using dplyr and add_row()
(The new error message says "Cannot add rows to grouped data frames" , which answers your question of why it is not working.)...
Read more >
Add rows to a data frame — add_row • tibble
This is a convenient way to add one or more rows of data to an existing data frame. See tribble() for an easy...
Read more >
How to Add Row to DataFrame in R? - Spark by {Examples}
Add Rows by Not Changing Data Types. Use list() instead of a vector to add a row. Adding a list() as a row...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found