Skip to content

Commit 410b1be

Browse files
authored
Fixed return type on getRows (#1564)
1 parent 18fde32 commit 410b1be

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,7 @@ export interface Worksheet {
12441244
/**
12451245
* Get or create rows by 1-based index
12461246
*/
1247-
getRows(start: number, length: number): Row[];
1247+
getRows(start: number, length: number): Row[] | undefined;
12481248

12491249
/**
12501250
* Iterate over all rows that have values in a worksheet

spec/integration/worksheet.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,13 @@ describe('Worksheet', () => {
639639
expect(count).to.equal(7);
640640
});
641641

642+
it('returns undefined when row range is less than 1', () => {
643+
const wb = new ExcelJS.Workbook();
644+
const ws = wb.addWorksheet('blort');
645+
646+
expect(ws.getRows(1, 0)).to.equal(undefined);
647+
});
648+
642649
context('when worksheet name is less than or equal 31', () => {
643650
it('save the original name', () => {
644651
const wb = new ExcelJS.Workbook();

0 commit comments

Comments
 (0)