Skip to content

[BUG] Async Iterators definition for typescript #1337

Closed
@JuhBoy

Description

@JuhBoy

🐛 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>;
  1. parentheses were missing.
  2. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy