From 4df7b1cfbce702545cc63ea6af4a56097c639c3e Mon Sep 17 00:00:00 2001 From: Hans Date: Mon, 1 Aug 2016 09:47:49 -0700 Subject: [PATCH] chore: fixes some issues that happen with closure compiler. (#10392) --- modules/@angular/compiler/src/compiler.ts | 2 +- .../@angular/core/src/metadata/ng_module.ts | 18 +++++++++--------- tools/public_api_guard/core/index.d.ts | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/@angular/compiler/src/compiler.ts b/modules/@angular/compiler/src/compiler.ts index 7b5c6c78f0..4009dd4dd2 100644 --- a/modules/@angular/compiler/src/compiler.ts +++ b/modules/@angular/compiler/src/compiler.ts @@ -222,6 +222,6 @@ function _lastDefined(args: T[]): T { function _mergeArrays(parts: any[][]): any[] { let result: any[] = []; - parts.forEach((part) => result.push(...part)); + parts.forEach((part) => part && result.push(...part)); return result; } diff --git a/modules/@angular/core/src/metadata/ng_module.ts b/modules/@angular/core/src/metadata/ng_module.ts index 8f080c9c51..896808ddf4 100644 --- a/modules/@angular/core/src/metadata/ng_module.ts +++ b/modules/@angular/core/src/metadata/ng_module.ts @@ -146,15 +146,15 @@ export class NgModuleMetadata extends InjectableMetadata implements NgModuleMeta schemas: Array; - constructor( - {providers, declarations, imports, exports, entryComponents, - schemas}: NgModuleMetadataType = {}) { + constructor(options: NgModuleMetadataType = {}) { + // We cannot use destructuring of the constructor argument because `exports` is a + // protected symbol in CommonJS and closure tries to aggressively optimize it away. super(); - this._providers = providers; - this.declarations = declarations; - this.imports = imports; - this.exports = exports; - this.entryComponents = entryComponents; - this.schemas = schemas; + this._providers = options.providers; + this.declarations = options.declarations; + this.imports = options.imports; + this.exports = options.exports; + this.entryComponents = options.entryComponents; + this.schemas = options.schemas; } } diff --git a/tools/public_api_guard/core/index.d.ts b/tools/public_api_guard/core/index.d.ts index b43d3f8ca5..76df76497c 100644 --- a/tools/public_api_guard/core/index.d.ts +++ b/tools/public_api_guard/core/index.d.ts @@ -805,7 +805,7 @@ export declare class NgModuleMetadata extends InjectableMetadata implements NgMo imports: Array; providers: any[]; schemas: Array; - constructor({providers, declarations, imports, exports, entryComponents, schemas}?: NgModuleMetadataType); + constructor(options?: NgModuleMetadataType); } /** @experimental */