From 8e84f8a1c431d454c2f3213fc54e05b2e535f3ae Mon Sep 17 00:00:00 2001 From: Josef Meier Date: Mon, 18 May 2015 08:11:13 +0200 Subject: [PATCH] chore: don't throw if paramTypes is undefined. Closes #1955 --- .../src/reflection/reflection_capabilities.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/angular2/src/reflection/reflection_capabilities.ts b/modules/angular2/src/reflection/reflection_capabilities.ts index ad86d1b249..31d401614c 100644 --- a/modules/angular2/src/reflection/reflection_capabilities.ts +++ b/modules/angular2/src/reflection/reflection_capabilities.ts @@ -48,12 +48,21 @@ export class ReflectionCapabilities { } _zipTypesAndAnnotaions(paramTypes, paramAnnotations): List> { - var result = ListWrapper.createFixedSize(paramTypes.length); + var result; + + if (typeof paramTypes === 'undefined') { + result = ListWrapper.createFixedSize(paramAnnotations.length); + } else { + result = ListWrapper.createFixedSize(paramTypes.length); + } + for (var i = 0; i < result.length; i++) { // TS outputs Object for parameters without types, while Traceur omits // the annotations. For now we preserve the Traceur behavior to aid // migration, but this can be revisited. - if (paramTypes[i] != Object) { + if (typeof paramTypes === 'undefined') { + result[i] = []; + } else if (paramTypes[i] != Object) { result[i] = [paramTypes[i]]; } else { result[i] = [];