node-csv-parse icon indicating copy to clipboard operation
node-csv-parse copied to clipboard

CsvError type missing from Typescript definition

Open drl-max opened this issue 4 years ago • 3 comments

Describe the bug

There isn't a way to get the CsvError class definition when using Typescript.

To Reproduce

In version 4.11.1 take a look at the ~/lib/index.d.ts file and notice that there is no definition for CsvError to be exported.

Additional context

I took some time to look through the repo and couldn't see if those typings were being generated by Typescript or if they were made by hand. Happy to help if I can.

drl-max avatar Aug 04 '20 19:08 drl-max

Yes, please help. I do not use Typescript, it is mostly based on contributions. I just request a test case to support new type definitions

wdavidw avatar Aug 04 '20 20:08 wdavidw

Please let me know if the test cases are missing anything. I just wanted to verify that the Typescript definition still accurately expresses the functionality and that this type is what's thrown when an error happens.

drl-max avatar Aug 05 '20 16:08 drl-max

This also fails transpilation:

(async () => {
    const parser = fs.createReadStream(`foo.csv`).pipe(csvParse({}));
    for await (const record of parser) {
        console.log("Processing record");
    }
})

with the following error:

error TS2504: Type 'Parser' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.

Gutza avatar Jan 08 '21 08:01 Gutza