mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
fix for "variable" (repeatable) params (#381)
This commit is contained in:
parent
eb9d95fa60
commit
a9405a8d10
@ -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;
|
||||
|
||||
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user