Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

115
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!