fix(typings): emit spread parameters

Closes #3875
This commit is contained in:
Alex Eagle 2015-08-27 13:19:24 -07:00 committed by Alex Eagle
parent 02d9e18279
commit a34d4c6a5f
2 changed files with 9 additions and 1 deletions

View File

@ -290,7 +290,11 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
' at line ' + location.start.line); ' at line ' + location.start.line);
} }
return declaration.parameters.map(function(parameter) { return declaration.parameters.map(function(parameter) {
var paramText = getText(sourceFile, parameter.name); var paramText = '';
if (parameter.dotDotDotToken) {
paramText += '...';
}
paramText += getText(sourceFile, parameter.name);
if (parameter.questionToken || parameter.initializer) { if (parameter.questionToken || parameter.initializer) {
paramText += '?'; paramText += '?';
} }
@ -298,6 +302,9 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
paramText += ':' + getType(sourceFile, parameter.type); paramText += ':' + getType(sourceFile, parameter.type);
} else { } else {
paramText += ': any'; paramText += ': any';
if (parameter.dotDotDotToken) {
paramText += '[]';
}
} }
return paramText.trim(); return paramText.trim();
}); });

View File

@ -11,6 +11,7 @@ import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_BINDINGS} from 'angular2/router';
template: '<h1>Hello</h1>', template: '<h1>Hello</h1>',
}) })
class FooCmp { class FooCmp {
constructor(a: string, b: number) {}
} }