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

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

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