From 29bc3a775fb85b815e266bdbdd015ddfe6558a3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matias=20Niemel=C3=A4?= Date: Fri, 18 Oct 2019 14:21:48 -0700 Subject: [PATCH] build: fix internal Google closure issue with TS3.6 (#33257) This patch fixes an internal Google issue that came up with the TS3.6 patch that landed earlier (go/b/142967802). PR Close #33257 --- packages/core/src/render3/view_engine_compatibility.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/src/render3/view_engine_compatibility.ts b/packages/core/src/render3/view_engine_compatibility.ts index b845e197c7..af6df59399 100644 --- a/packages/core/src/render3/view_engine_compatibility.ts +++ b/packages/core/src/render3/view_engine_compatibility.ts @@ -225,7 +225,13 @@ export function createContainerRef( ngModuleRef?: viewEngine_NgModuleRef|undefined): viewEngine_ComponentRef { const contextInjector = injector || this.parentInjector; if (!ngModuleRef && (componentFactory as any).ngModule == null && contextInjector) { - ngModuleRef = contextInjector.get(viewEngine_NgModuleRef, null) || undefined; + // DO NOT REFACTOR. The code here used to have a `value || undefined` expression + // which seems to cause internal google apps to fail. This is documented in the + // following internal bug issue: go/b/142967802 + const result = contextInjector.get(viewEngine_NgModuleRef, null); + if (result) { + ngModuleRef = result; + } } const componentRef =