tjohnston-softdev / papaparse-min

Minified version of 'papaparse' library. (Node JS)
https://www.npmjs.com/package/papaparse-min
MIT License
0 stars 0 forks source link

Declaration file for module papaparse-min #1

Open david-vendel opened 2 years ago

david-vendel commented 2 years ago

Hello, I use 'papaparse-min' module in NextJS TypeScript app. Upon running type check npx tsc I get

Could not find a declaration file for module 'papaparse-min'. '/Users/david/Documents/github/web-app-fe/node_modules/papaparse-min/papaparse.min.js' implicitly has an 'any' type. Try npm i --save-dev @types/papaparse-min if it exists or add a new declaration (.d.ts) file containing declare module 'papaparse-min';

When I tried running npm i --save-dev @types/papaparse-min I got ERR! 404 '@types/papaparse-min@*' is not in this registry.

Any solution how to provide TS support?

tjohnston-softdev commented 2 years ago

Hello, David. I'm glad you took the time to reach out.

In case you have not read the readme, this library is simply the minified version of Papaparse wrapped into an NPM package for people who like to keep things organized. I have nothing to do with the code itself, I just publish the minified versions under a separate name. (The current maintainer has given me his blessing)

I don't use TypeScript myself so my knowledge in supporting it is quite limited. While I haven't seen any real indication that Papaparse actively supports TypeScript, I did see that it does have a @types definition. Maybe you could try installing @types/papaparse instead and see what that does.

Like I said, I don't know much about updating existing libraries for TS compatibility so it is something I might have to look into sometime. Try using the original library @types definitions and get back to me.

david-vendel commented 2 years ago

Thank you for the answer. I understand this is mimified verion of papaparse. Running npm i --save-dev @types/papaparse didn't provide the types declaration. Indeed it's a good idea and probably close to the solution, I also don't know much about creating types declaration. It's not pressing. For now I just disabled the TS error, by using:

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore