How to recognize the type variable imported

I have a file which exports a moongose.model


module.exports = moongose.model("User", userSchema);

In whatever file I import it, Webstorm doesn't recognize the type of the variable.


const User = require("user");
User.[no autocomplet]

Should Webstorm be smart enough and recognize it's a moongose model?

1 comment
Comment actions Permalink

Providing completion for your schema fields/methods requires adding special support for Mongoose, as objects generated in runtime can't be resolved by static code analysis. We have a feature request for this, please feel free to vote: WEB-22317.


Please sign in to leave a comment.