npm-pdfreader: It is not supporting the TS type declaration.

Describe the bug Could not find a declaration file for module ‘pdf reader’

To Reproduce

  1. I am using Next JS application with TS support, and getting an error as Could not find a declaration file for module ‘pdf reader’. import { PdfReader } from "pdfreader";
  2. Also tried to look for the Type definition file on yarn packages but was not found.
Screenshot 2023-07-23 at 11 11 34 AM

Tq 🙃.

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 3
  • Comments: 24 (15 by maintainers)

Most upvoted comments

Hello Team (@adrienjoly and @niemal),

I have created the type declaration files for all the modules and here you can check them. https://github.com/adrienjoly/npm-pdfreader/compare/master...Basavarajrp:npm-pdfreader:master

“Please let me know if I’m heading in the right direction. While I still need to test and refine this further, I would appreciate your input on whether my current progress is on track.”

Version 3.0.1 includes the type definitions your proposed in your pull request. Thank you for your contribution!

@niemal , are you working on this? Or should I continue working on this? I am happy to work on this.

You should continue to work on this, I am working on something else but I am happy to provide any input I can.

Hi @adrienjoly ,

Thank you for this guidance, I will work on it and get back to you if any help is needed.

Tq 😊.

Awesome!

Here’s the official procedure on how to add type declarations in a npm package: https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#including-declarations-in-your-npm-package

Here is the steps to follow in order to contribute that change to pdfreader’s github repository:

  1. fork the repository to your own github account => git clone it from there to your computer
  2. add the type declarations, and make sure that they work as expected (e.g. from a test project that imports your version of pdfreader)
  3. commit the changes and create the pull request back to this github repository

Let me know if your need assistance on any of these steps.

Hi, thanks for the heads up!

There are currently no TypeScript types defined for pdfreader. But that would be a nice addition indeed!

I’m guessing that writing a index.d.td file in this repo and linking package.json to it would do.

@Basavarajrp, would you be interested in doing it and proposing this evolution as a Pull Request? I can help if needed.