0

Consider the first file -> one.js where i import another class from another file called two.js

One.js

const twoService = require('./two')
const twoObj = new twoService()
Class First{
constructor(){}

helperOne(){
twoObj.helperTwo()
}
}

Now consider the second file , two.js , where i'm importing the class from the first file -> one.js

Two.js

const oneService = require('./one')
const oneObj = new oneService()
Class Second{
constructor(){}

helperTwo(){
oneObj.helperOne()
}
}

So simple , I have two classes which has dependent functions of each other , so when I call the One.js file and invoke the First class , i'm getting the error as TypeError: oneService is not a constructor

How It can be solved ???

CHECoder08
  • 41
  • 3

0 Answers0