1

I'm a little confused as to which JSDoc describes a constructor function for a class, and if PHPStorm understands either.

When I research which JSDoc to use I keep coming across two versions. There is @constructs and @constructor.

  • Do these two tags mean the same thing?
  • Which tag should I use in my JSDoc?
  • Is there a benefit in PHPStorm for code complete or intellisense using either?

Here are some references.

https://code.google.com/p/jsdoc-toolkit/wiki/TagConstructor

https://code.google.com/p/jsdoc-toolkit/wiki/TagConstructs

Now I understand that @constructs should be used with @lends but why?

4

1 回答 1

1

如果您需要将函数标记为构造函数,@constructor 是正确的选择。@constructs 仅适用于借出函数,并且只能与 @lends 标记一起使用(只能出现在对象文字上)。有关@lends 标签的更多信息,请参阅此 Wiki 页面。请注意,PHPStorm 支持类型提示/导航的两个标签

于 2013-08-06T15:04:01.020 回答