The component looks like this:
mappedChoices$ = new BehaviorSubject<SomeType[]>([]);
[choices]="mappedChoices$ | async"
Ivy build error:
Type 'null' is not assignable to type 'SomeType[]'.
WTF? It's initialized as an empty array.
The component looks like this:
mappedChoices$ = new BehaviorSubject<SomeType[]>([]);
[choices]="mappedChoices$ | async"
Ivy build error:
Type 'null' is not assignable to type 'SomeType[]'.
WTF? It's initialized as an empty array.
The async pipe transform will convert an Observable<T> into T|null and will return null until a value is emitted. It can't guarantee that an Observable will emit a value right after the subscription, hence the initial value of null.
I guess an override could be added to the async pipe code so that if input is BehaviorSubject<T> the output is T not T|null.
https://github.com/angular/angular/blob/master/packages/common/src/pipes/async_pipe.ts#L102
private _latestValue: any = null;
...
transform<T>(obj: Observable<T>|Subscribable<T>|Promise<T>): T|null;