WebStorm typeguess classname vs. instance name

How can I teach WebStorm that a JavaScript variable "fooBarBaz" is an instance of class "FooBarBaz"? This is a very simple and obvious convention, it should be supported out of the box, or at least be configurable.

3 comments
Comment actions Permalink

You can try using JSDoc @type annotation - see https://github.com/jsdoc3/jsdoc/issues/949, for example

0
Comment actions Permalink

Thx, that or @param would work perfectly well. If there is a way without adding JSDoc for everything, it would be helpful. This is very cumbersome, especially for class constructors with several dependencies. We use an IOC Container, updating JSDoc is tedious and not necessary grunt work.

To me, this conventions seem simple enough, to add that to the type guessing mechanism, doesn't it?

0
Comment actions Permalink

please feel free to file a request for this feature to youtrack, https://youtrack.jetbrains.com/issues/WEB. Related ticket: https://youtrack.jetbrains.com/issue/WEB-3935

0

Please sign in to leave a comment.