You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Search Terms: jsdoc import module.exports has no exported member
Code
a.js
classA{}module.exports={A}
b.js
// @ts-checkclassB{// In the JSDoc below, VSCode intellisense does not recognize parameter a as type A.// Instead it shows the error:// Namespace '".../a".export=' has no exported member 'A'/** * @param {import('./a').A} a */constructor(a){this.a=a}}
Expected behavior
Parameter a of the constructor should be recognized as type A, which is accessible via the A property of module.exports from a.js.
Actual behavior
Intellisense reports the error: Namespace '".../a".export=' has no exported member 'A'.
Notes @param {import('./a')} a does not give an error, but it resolves to type {A: typeof A} instead of A.
If a.js is modified with module.exports = A, then import('./a') resolves to A, however this restricts a.js to only exporting one type.
The text was updated successfully, but these errors were encountered:
This bug is currently blocking our team from adopting ts-check into our Javascript codebase, as we have .js files that export classes, and those classes can't be used in our ts-checked files until this bug is resolved.
As a workaround, we could define our own .d.ts files for the modules in question, but this is a lot of what we feel is duplicate work - the types are already defined in jsdoc format inline in the files.
TypeScript Version: 3.3.0-dev.20190118
Search Terms: jsdoc import module.exports has no exported member
Code
a.js
b.js
Expected behavior
Parameter
a
of theconstructor
should be recognized as typeA
, which is accessible via theA
property ofmodule.exports
froma.js
.Actual behavior
Intellisense reports the error: Namespace '".../a".export=' has no exported member 'A'.
Notes
@param {import('./a')} a
does not give an error, but it resolves to type{A: typeof A}
instead ofA
.If
a.js
is modified withmodule.exports = A
, thenimport('./a')
resolves toA
, however this restrictsa.js
to only exporting one type.The text was updated successfully, but these errors were encountered: