From c557cd0a8befe8e50eca720c72072b985174dd0f Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sat, 26 Jul 2014 14:16:25 -0700 Subject: [PATCH] use the correct type expression for type applications that contain type unions (#714) --- lib/jsdoc/tag/type.js | 2 +- test/specs/jsdoc/tag/type.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/jsdoc/tag/type.js b/lib/jsdoc/tag/type.js index b0ca81f2..1720d804 100644 --- a/lib/jsdoc/tag/type.js +++ b/lib/jsdoc/tag/type.js @@ -196,7 +196,7 @@ function getTypeStrings(parsedType, isOutermostType) { // if this is the outermost type, we strip the modifiers; otherwise, we keep them if (isOutermostType) { applications = parsedType.applications.map(function(application) { - return getTypeStrings(application); + return catharsis.stringify(application); }).join(', '); typeString = util.format( '%s.<%s>', getTypeStrings(parsedType.expression), applications ); diff --git a/test/specs/jsdoc/tag/type.js b/test/specs/jsdoc/tag/type.js index 7b8c41c2..4add5b00 100644 --- a/test/specs/jsdoc/tag/type.js +++ b/test/specs/jsdoc/tag/type.js @@ -243,6 +243,13 @@ describe('jsdoc/tag/type', function() { expect(info.type).toEqual( ['string'] ); expect(info.variable).toBe(true); }); + + it('should set the type correctly for type applications that contain type unions', + function() { + var desc = '{Array.<(string|number)>} foo - Foo.'; + var info = jsdoc.tag.type.parse(desc, true, true); + expect(info.type).toEqual(['Array.<(string|number)>']); + }); }); }); });