mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
use the correct type expression for type applications that contain type unions (#714)
This commit is contained in:
parent
b5653b838c
commit
c557cd0a8b
@ -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 );
|
||||
|
||||
@ -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)>']);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user