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

119
Vistas
Visual Studio Code Class Selection for multiple identical names

So I can across this today and it might already have been answered somewhere but I'm curious why this isn't picking up all classes with the same name. So I have two requires from two different classes of two different areas of testing that have the same name.

Const AreaOneLoginPage = require('../../pages/areaOne/login.page');
Const areaOneLoginIn = new AreaOneLoginPage();
Const AreaTwoLoginPage = require('../../pages/areaTwo/login.page');
Const areaTwoLoginIn = new AreaTwoLoginPage ();

However when I try to construct this in a different way using the smart logic in Visual Studio Code. This always defaults to AreaOne.

Const areaOneLogin = new LoginPage(); //<== This is the class name of the first area.
Const areaTwoLogin = new LoginPage(); //<== This is the class name of the second area.

The only option Visual Studio picks up is AreaOne and not show all the Classes that link into LoginPage??

Is this just a Visual Studio thing that can be fixed or is this a javascript thing?

Or is it best to refactor the class names to two different names completely. I just figured that VS Code would be able to determine that the class is nested below a seperate folder location?

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

0

You can import the one module in one file many times, if they will be named unique. And then you can create new objects from these classes/modules.

To prevent this we have Singleton Pattern. it saves the instance of itself and if there was the init earlier, you will get the instance of exsisting object instead of creating new one.

Hope this was the answer to your question

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