Skip to content

Commit

Permalink
refactor(ivy): avoid type coercion in saveNameToExportMap function (a…
Browse files Browse the repository at this point in the history
…ngular#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 angular#34335
  • Loading branch information
AndrewKushnir authored and josephperrott committed Dec 11, 2019
1 parent 5bcccb8 commit 985d9d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/render3/instructions/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ function saveNameToExportMap(
exportsMap[def.exportAs[i]] = index;
}
}
if ((def as ComponentDef<any>).template) exportsMap[''] = index;
if (isComponentDef(def)) exportsMap[''] = index;
}
}

Expand Down

0 comments on commit 985d9d3

Please sign in to comment.