How to properly define own type of class in JSDoc?
问题 I have a simple ES6 class and I'm wondering how to properly describe it in JSDoc. Note that I want to define my own type, which later would be recognized by WebStorm autocomplete. Is below example valid? /** * @typedef {Object} View * @class */ class View{...} 回答1: That's a really good question. The way I do today is to declare all my class instance variables in its constructor, annotating each one with its expected type. It's a good practice and works very well with Webstorm. For instance: