Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

342
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda