Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » jsdoc, arrays, and @type(A few questions about using jsdoc with arrays and @type)
jsdoc, arrays, and @type [message #757529] Fri, 18 November 2011 19:10 Go to next message
tdunnigan  is currently offline tdunnigan Friend
Messages: 1
Registered: November 2011
Junior Member
Hi all,

I have a few questions regarding jsDoc, arrays, and @type.

1) Are curly braces { } required when specifying a type?
@param {string} familyName The user's family name
@param string familyName The user's family name


2) How do I specify arrays of objects? Say I have an object 'Person'. I've seen jsdoc examples defining arrays in a couple of ways:

@param {Person[]} people An array of person objects
@param {Array.<Person>} people An array of person objects

When I try either option I get the warning "JSdoc: Invalid tag param name".

3) When I define a type of an instance variable Eclipse doesn't seem to be picking up on it.

/**
 * @constructor
 */
function Person () {
  /** @type {string} */
  this.familyName = null;
}

/**
 * @constructor
 */
function Payroll () {
  /** @type {Person} */
  this.employee;
}

Payroll.prototype.GiveRaise = function() {
  this.employee. 
}

Now when I create this function I try to auto-complete after 'this.employee.' but Eclipse can't offer any auto-completes. I was expecting it to present "familyName". Am I doing something wrong?

[Updated on: Fri, 18 November 2011 19:11]

Report message to a moderator

Re: jsdoc, arrays, and @type [message #759198 is a reply to message #757529] Sun, 27 November 2011 15:19 Go to previous message
Philippe Marschall is currently offline Philippe MarschallFriend
Messages: 121
Registered: July 2009
Senior Member
On 18.11.2011 20:10, tdunnigan wrote:
> Hi all,
>
> I have a few questions regarding jsDoc, arrays, and @type.
>
> 1) Are curly braces { } required when specifying a type?
> @param {string} familyName The user's family name
> @param string familyName The user's family name
>
> 2) How do I specify arrays of objects? Say I have an object 'Person'.
> I've seen jsdoc examples defining arrays in a couple of ways:
>
> @param {Person[]} people An array of person objects
> @param {Array.<Person>} people An array of person objects

jsdoc2 says the first way [1] but JSDT doesn't support it [2]

[1]
http://code.google.com/p/jsdoc-toolkit/wiki/TagParam#Parameter_Type_Information
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=324869

Cheers
Philippe
Previous Topic:&quot;static&quot; confusion in JSDT auto completion proposals
Next Topic:experiences from writing a JSDT plugin
Goto Forum:
  


Current Time: Tue Apr 23 08:30:56 GMT 2024

Powered by FUDForum. Page generated in 0.03317 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top