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

242
Vistas
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 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