Skip to content

How to document array elements? #1073

Open
@brunano21

Description

@brunano21

Hi,
I have a function that takes an array of strings.
Something like:

function myFunc(args) {
    var a = args[0];
    var b = args[1];
}

But I want to specify what each element within the array represents.
How can I achieve that? I tried with something like:

/**
 * @param {String[]} args
 * @param {String}  args.0 - attribute name.
 * @param {String}  args.1 - value to set.
 */

But obviously this is wrong since they are interpreted as properties.
Of course, I also tried with args[0] but I get an error at jsdoc generation phase.
Finally, Google did not help this time. :/
Any suggestion?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions