Bunlong / react-papaparse

react-papaparse is the fastest in-browser CSV (or delimited text) parser for React. It is full of useful features such as CSVReader, CSVDownloader, readString, jsonToCSV, readRemoteFile, ... etc.
https://react-papaparse.js.org
MIT License
363 stars 60 forks source link

Fix typescript type #121

Open Bunlong opened 2 years ago

ghost commented 2 years ago

Maybe a silly question, but is this to fix the fact that typing doesn't seem to be working right now? Definitely missing this...

dr-leevsey commented 2 years ago

Are you planning to add exports to all the related types, not only for main declarations? In my case I use readString and to type Error properly in my react state I had to write such a cumbersome thing:

type ParseError = Parameters<
  Parameters<ReturnType<typeof usePapaParse>['readString']>[1]['complete']
>[0]['errors'][number];

ofc that works for now, however (apart from the fact this is very odd chunk of code :)) I have absolutely no guarantee that signature will not change in future versions would be really good to just import that type from react-papaparse module