Unresolved type for dynamic module.exports

Hey!

I wonder how i can resolve dynamic exports with IntelliJ IDEA latest.


File: a.js

obj = {

  something: 'something'

}

 

_.each(obj, function(value, key) {

  module.exports[key] = value;

});

 

File: b.js


a = require('a')

a.something


a.something shows "Unresolved type something".

 

Thank you.

 

4 comments
Comment actions Permalink

no way; such exports can't be resolved during static code analysis.

 

0
Comment actions Permalink

Any workaround/ideas?

0
Comment actions Permalink

the only possible workaround is creating typescript stubs for your library

1
Comment actions Permalink

Elena Pogorelova
Sorry to up that old thread but could you please provide a concrete sample on how to create a typescript stub for the upper "a.js" and "b.js" files ?
I'm not used to typescript and didn't figured that out by myself after a few search on the subject.

0

Please sign in to leave a comment.