From c8b5b81516d2f5848611018b69de5be79f55d3d9 Mon Sep 17 00:00:00 2001 From: Andrew Kushnir Date: Tue, 10 Dec 2019 11:48:30 -0800 Subject: [PATCH] refactor(ivy): avoid type coercion in `saveNameToExportMap` function (#34335) TypeScript 3.7 flags `if` conditions that implicitly coerce a function/method definition. While checking for the `template` presence on a def (actually checking whether we work with Component) in `saveNameToExportMap`, the `if` condition had implicit type coercion. This commit updates the condition to use the `isComponentDef` function (that checks `def.template` against `null` internally) to avoid compilation errors with TypeScript 3.7. PR Close #34335 --- packages/core/src/render3/instructions/shared.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/render3/instructions/shared.ts b/packages/core/src/render3/instructions/shared.ts index 7f5f98481c..fd9ad77efa 100644 --- a/packages/core/src/render3/instructions/shared.ts +++ b/packages/core/src/render3/instructions/shared.ts @@ -1304,7 +1304,7 @@ function saveNameToExportMap( exportsMap[def.exportAs[i]] = index; } } - if ((def as ComponentDef).template) exportsMap[''] = index; + if (isComponentDef(def)) exportsMap[''] = index; } }