Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

339
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda