Support nullable params and returns in generated externs

This commit is contained in:
Andreas Hocevar
2014-08-27 18:18:49 +02:00
parent 4e8abb62f9
commit 663fef3dfd
2 changed files with 13 additions and 3 deletions

View File

@@ -105,12 +105,14 @@ function generateExterns(typedefs, symbols, externs) {
lines.push(' * @param {' +
(param.variable ? '...' : '') +
noGoogTypes(param.types).join('|') +
(param.optional ? '=' : '') +
(param.optional ? '=' : '') + (param.nullable ? '!' : '') +
'} ' + param.name);
});
}
if (symbol.returns) {
lines.push(' * @return {' + noGoogTypes(symbol.returns).join('|') + '}');
lines.push(' * @return {' +
(symbol.returns.nullable ? '!' : '') +
noGoogTypes(symbol.returns.types).join('|') + '}');
}
if (symbol.template) {
lines.push(' * @template ' + symbol.template);