Closed
Description
🐛 Bug Report
When trying to use WorkbookReader
as an async iterator with a for await of
the TSC isn't recognizing the Symbol.asyncIterator property as defined.
Lib version: ^4.0.1
Steps To Reproduce
const workbookReader: IWorkbookReader = new exceljs.stream.xlsx.WorkbookReader(readStream, {});
for await (const workbookSheet of workbookReader) {}
Exception: The WorkbookReader
type must have a [Symbol.asyncIterator]()
method which returns an asynchronous iterator.
The expected behaviour:
No errors should be triggered when using async iterators with an async loop.
Possible solution (optional, but very helpful):
Change the definition inside the index.d.ts line 1960 && 1974 like so:
[Symbol.asyncIterator](): AsyncGenerator<WorksheetReader>;
- parentheses were missing.
- Due to the implementation in JS code, it would be better to use AsyncGenerator instead of AsyncIterator Generics interfaces.
I could push a pull request if you wan't (and if i'm not wrong about all of this).
Thanks & have a good day.
Metadata
Metadata
Assignees
Labels
No labels