0

Using JSDuck for the documentation of my ExtJS application, I try to add a configuration that has to be String[8]:

/**
 * @cfg {String[8]} FooColors The eight colors to use for foo. All CSS color formats (Hex, RGB, RGBA, color names...) are valid.
 */

The error is

incorrect type syntax String[8]

Using {String} instead of {String[8]}, everything works; so the issue is the square brackets. But what syntax do I need to use?

I have not found any help in the type definition docs.

Alexander
  • 19,906
  • 19
  • 75
  • 162
  • 1
    Pretty sure it's not possible, you should just note the length in the docs (and perhaps validate it with a debug block in the code). – Evan Trimboli Feb 01 '16 at 12:14

1 Answers1

1

Indeed. That's not possible, and unlikely to be supported, as it's a fairly uncommon scenario to require an array of certain length. Just use {String[]} and simply document the required length with words.

I'd also suggest you seriously consider why do you need an array of 8 colors. Maybe an object with named keys for all these colors would be more appropriate, or maybe you could allow an arbitrary number of colors.

Rene Saarsoo
  • 13,580
  • 8
  • 57
  • 85