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

239
Visualizações
How to reference a type declaration file for Javascript in another folder?

I am trying to write typescript declaration files for my Javascript files, but wishing to store them in a separate folder:

src/
  types/
    foo.d.ts
  foo.js
// foo.d.ts
export function foo(bar): number
// foo.js
export const foo = bar => bar.length
// The type suggestion when calling foo from another file 
foo() //(alias) const foo: (bar: any) => any

Now when I import and call foo in other files, the type suggestion doesn't work. When I do something like this before, I had to put the .d.ts file in the same directory as the JS file. I tried adding /// <reference/> but it didn't help or I have done it incorrectly. I am not trying to export the declaration files, and it is purely for helping me during development. How can I do this?

about 4 years ago · Juan Pablo Isaza
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