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.
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.