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

268
Vistas
Wildcard imports with `as` in JavaScript

I am primarily a JavaScript developer, but with some recent exposure to Java, I rather enjoy how Java handles wildcard imports. Without using any as statements, the import takes all named imports and imports them directly into the current namespace/scope as variables/classes without any need for there to be one variable they are properties of.

Is this possible in JavaScript. For example, if I make this export:

Export Example

export const a = 1;
export const b = 2;
export const c = 3;
export default const d = 4;

Then this would be true of related imports:

Wildcard Imports Example

import * as Foo from "./file.js";

Foo.a // -> 1
Foo.b // -> 2
Foo.c // -> 3
Foo.d // -> 4

Default Import Example

import Foo from "./file.js";

Foo // -> 4

Specific/Named Imports Example

import { a, b } from "./file.js";

a // -> 1
b // -> 2
c // -> undefined
d // -> undefined

What I am looking for, which it appears Java supports, is the ability to do something like the current JavaScript wildcard import, but without the as statement, like the below example, where all named exports are imported as fully accessible variables within the current namespace/scope:

Wildcard Imports (without as) Example - DESIRED

import * from "./file.js";

a // -> 1
b // -> 2
c // -> 3
d // -> 4

Is this possible?

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