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

190
Vistas
Typescript how to import and export

Here is the script line in html

<script src="a.js"></script>

I have also tried setting type="module"

a.ts

import {hello} from "./b"
console.log(hello);

b.ts

export let hello: string = "bob";

I have also tried a bunch of different options in my tsconfig file like changing the module to everything possible option as well as the target

Nothing is logged to console sometimes error like exports is not defined or define is not defined or sometimes no errors but nothing is shown

Please help.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The solution seems to be pretty simple. Add .js at the end of the import line

import {hello} from "./b.js"

and it should work fine. Maybe the problem was that JS didn't know what file should be imported.

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