[BUG] getSheetValues() typescript definition is incorrect
danielnitsche opened this issue Β· comments
π Bug Report
Lib version: 3.9.0
Steps To Reproduce
getSheetValues()
is defined as:
/**
* return all rows as sparse array
*/
getSheetValues(): Row[];
So one would expect a Row
type to be returned.
The expected behaviour:
However reviewing the code for this function:
// return all rows as sparse array
getSheetValues() {
const rows = [];
this._rows.forEach(row => {
if (row) {
rows[row.number] = row.values;
}
});
return rows;
}
A plain array is being returned instead.
Possible solution (optional, but very helpful):
Update type definition to
/**
* return all rows as sparse array
*/
getSheetValues(): Cell[][];
@Alanscut we shout avoid using of any
. It means that we haven't idea what happens.
As we can find here:
Lines 536 to 540 in 2d82154
the following code should works great:
type RowValues=CellValue[] | { [key: string]: CellValue };
/*...*/
getSheetValues(): RowValues[];
P.S. I wrote it in comment without test, please apologize if I made a mistake.