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

264
Vistas
How to import vanilla JavaScript objects in TypeScript

I have a traditional JavaScript file, say abc.js that does something like this:

// abc.js
if (typeof ABC !== "object") {
    ABC = {};
}
(function () {
   // ... construct the ABC object
})

This is a 3rd-party dependency that I cannot touch.

Then, in my TypeScript file, say main.ts, I want to include the ABC object defined in abc.js so that the TypeScript checker can understand it.

Ideally I would like to end up with a single .js file after the compilation. What's the correct way of doing it?

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

0

You can access to the JavaScript Object through window For example: import "spotlight" window.Spotlight.show(...) How to import Vanilla JS ES6 modules in TypeScript?

about 4 years ago · Juan Pablo Isaza Denunciar

0

You might need to tweak tsconfig.json

{
  "compilerOptions": {
    "allowJs": true,
    "checkJs": false,
  }
}

and import in main.ts:

import * as ABC from './abc';
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