alberthaff / ngx-papaparse

Papa Parse wrapper for Angular
https://alberthaff.dk/projects/ngx-papaparse/docs/v8
MIT License
90 stars 19 forks source link

complete callback has wrong signature #28

Closed or1can closed 6 years ago

or1can commented 6 years ago

Describe the bug

The complete callback has the following signature is PapaParseConfig

complete?: (results: PapaParseResult, parser: PapaParseParser) => void;

but Papa Parse actually calls with the results and a File object if parsing a local file.

This causes type errors when using this callback and the only workaround I found was to define a complete callback specifying the type of the second argument as any, e.g.

complete: (results, file: any) => {}

The signature for step looks correct, I'm not sure about chunk.

alberthaff commented 6 years ago

Hi. Thanks for the error-report. Are you using ngx-papaparse 2.x or 3.x?

or1can commented 6 years ago

I'm using 3.0.0-beta.0

alberthaff commented 6 years ago

Thanks. I'll take a look at it. :-)

alberthaff commented 6 years ago

I have changed the interface to:

complete?: (results: PapaParseResult, file?: File) => void;.

The change will be included in the next release.