node-csv-parse
node-csv-parse copied to clipboard
CsvError type missing from Typescript definition
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.
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
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.
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.