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

307
Vistas
How to import typescript file in javascript file

I am trying to import a typescript file (src/index.ts) in a javascript file(tests/steps/utils.js)

But when I use const index_1 = require("../../src/index"); in my javascript file, it gives an error: Cannot find module '../../src/index'

But the file is right there. Is there any other way to import a typescript file into a javascript file?

almost 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

You can't. You need to compile the transcript files into js first.

almost 4 years ago · Santiago Trujillo Denunciar

0

You can't import a ts into js file.

If you really need the module in .ts file, try to import from dist folder, where the ts compiler output path, or refactor into javascript.

almost 4 years ago · Santiago Trujillo 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