Problem
Angular doesn't do type narrowing based on conditions in *ngIf
or *ngSwitchCase
(angular/angular#20780).
And, making it worse, there is no way to write a type assertion directly in a template.
With strictInputTypes
check turned on it can result in a number of false positive compile time errors.
A common workaround is to have a method in your component that does type assertion, and call this method in a template.
Naive approach