diff --git a/lib/jsdoc/tag/type.js b/lib/jsdoc/tag/type.js index b49577a7..a783a083 100644 --- a/lib/jsdoc/tag/type.js +++ b/lib/jsdoc/tag/type.js @@ -167,11 +167,17 @@ function parseTypeExpression(tagInfo) { if (parsedType) { tagInfo.type = tagInfo.type.concat( getTypeStrings(parsedType) ); - ['optional', 'nullable', 'variable'].forEach(function(key) { + // Catharsis and JSDoc use the same names for 'optional' and 'nullable'... + ['optional', 'nullable'].forEach(function(key) { if (parsedType[key] !== null && parsedType[key] !== undefined) { tagInfo[key] = parsedType[key]; } }); + + // ...but not 'variable'. + if (parsedType.repeatable !== null && parsedType.repeatable !== undefined) { + tagInfo.variable = parsedType.repeatable; + } } return tagInfo; diff --git a/test/specs/jsdoc/tag/type.js b/test/specs/jsdoc/tag/type.js index bec572f8..89133e14 100644 --- a/test/specs/jsdoc/tag/type.js +++ b/test/specs/jsdoc/tag/type.js @@ -179,5 +179,15 @@ describe('jsdoc/tag/type', function() { expect(info.defaultvalue).toBe('hooray'); }); }); + + // TODO: add more tests related to how JSDoc mangles the Catharsis parse results + describe('Closure Compiler-style type info', function() { + it('should recognize variable (repeatable) parameters', function() { + var desc = '{...string} foo - Foo.'; + var info = jsdoc.tag.type.parse(desc, true, true); + expect(info.type).toEqual( ['string'] ); + expect(info.variable).toBe(true); + }); + }); }); });