VsCode IntelliSense and node/web-shared classes

32 Views Asked by At

as we all know, we can easily use classes from a single file for both Node and web applications.

//myclass.js
class MyClass { /* ... */ };
if (typeof module === "object")
{
    module.exports = { MyClass };
}

However, the directive module.exports = { MyClass }; causes IntelliSense to no more recognize MyClass in web js files. (Of course it's included in my jsconfig.json).

Adding a /// <reference path="..." /> didn't help.

Adding a @typedef ... @type {import(...) JsDoc didn't help.

I won't blame VsCode for having a bug here but I rather think I've got something wrong.

I appreciate any help. Thanks.

0

There are 0 best solutions below