Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

348
Views
My JS npm package causes 'Could not find a declaration file for module' error?

I published an npm package that is JavaScript. It works fine, but there are always three dots in front of the name when you import it into another app and an error message that says:

Could not find a declaration file for module 'my-npm-package'

How do i create a declaration file? The package is not TypeScript. I've never used TypeScript before.

Here is how may file tree looks:

index.js
package.json
README.md
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you can use this command to generate a index.d.ts file:

tsc --declaration --allowJs --emitDeclarationOnly index.js

NOTE: if you don't have typescript installed in your system, you need it for this command to work:

npm install -g typescript

also you can add a types section to your package.json file to point to your declarations file.

{
...
"main": "index.js",
"types": "index.d.ts",
...
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!