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
This commit is contained in:
parent
f0f65443c6
commit
e0a8376237
@ -26,7 +26,7 @@ export class MessageBundle {
|
|||||||
private _implicitAttrs: {[k: string]: string[]}, private _locale: string|null = null) {}
|
private _implicitAttrs: {[k: string]: string[]}, private _locale: string|null = null) {}
|
||||||
|
|
||||||
updateFromTemplate(html: string, url: string, interpolationConfig: InterpolationConfig):
|
updateFromTemplate(html: string, url: string, interpolationConfig: InterpolationConfig):
|
||||||
ParseError[]|null {
|
ParseError[] {
|
||||||
const htmlParserResult = this._htmlParser.parse(html, url, true, interpolationConfig);
|
const htmlParserResult = this._htmlParser.parse(html, url, true, interpolationConfig);
|
||||||
|
|
||||||
if (htmlParserResult.errors.length) {
|
if (htmlParserResult.errors.length) {
|
||||||
@ -41,7 +41,7 @@ export class MessageBundle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._messages.push(...i18nParserResult.messages);
|
this._messages.push(...i18nParserResult.messages);
|
||||||
return null;
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the message in the internal format
|
// Return the message in the internal format
|
||||||
|
Loading…
x
Reference in New Issue
Block a user