From d0e16885141dd658a612fa59b5ab3875a8a27312 Mon Sep 17 00:00:00 2001 From: Martin Probst Date: Thu, 4 May 2017 19:36:05 +0200 Subject: [PATCH] fix(compiler): avoid a `...null` spread in extraction (#16547) This code only runs in ES5 mode in the test suite, so this is difficult to test. However `updateFromTemplate` is being called with a spread operator, as `...updateFromTemplate(...)`. The spread operator should fail on `null` values. This change avoids the problem by always returning a (possibly empty) array. PR Close #16547 --- packages/compiler/src/i18n/message_bundle.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/compiler/src/i18n/message_bundle.ts b/packages/compiler/src/i18n/message_bundle.ts index 54c7245580..e685478367 100644 --- a/packages/compiler/src/i18n/message_bundle.ts +++ b/packages/compiler/src/i18n/message_bundle.ts @@ -26,7 +26,7 @@ export class MessageBundle { private _implicitAttrs: {[k: string]: string[]}, private _locale: string|null = null) {} updateFromTemplate(html: string, url: string, interpolationConfig: InterpolationConfig): - ParseError[]|null { + ParseError[] { const htmlParserResult = this._htmlParser.parse(html, url, true, interpolationConfig); if (htmlParserResult.errors.length) { @@ -41,7 +41,7 @@ export class MessageBundle { } this._messages.push(...i18nParserResult.messages); - return null; + return []; } // Return the message in the internal format