Within my codebase, I have a private package that exports a class called Table
. Another package in use also utilizes this class, as does my web application.
One of the test cases inside the second package looks like this:
if (!(table instanceof Table)) {
throw new TypeError(table + ' is not an instance of Table');
}
I set a breakpoint here and upon logging the table
, it indeed appears to be a valid instance of Table
. However, upon closer examination of the compiled code, I noticed:
if (!(table instanceof _mypackage2.Table)) {
throw new TypeError(table + ' is not an instance of Table');
}
It seems that there are different instances of the Table
class, with the one from the second package being distinct from the original. Initially, I thought this might be due to version mismatches within the packages, but after running npm list mypackage
, the output indicated:
├── @pck/user1/@pck-package1/1.0.0
└─┬ @pck/user1/@pck-package2/1.0.0
├── @pck/user1/@pck-package3/1.0.0
Even though the package versions appear consistent, how can I verify the instance or ensure consistency between these packages? Your insights would be greatly appreciated.