We are accessing a Slice Object Store Observable ( obs
) directly in our Angular template like this:
<fs-data-table [tableData$]="s.OS.S.SALES_HISTORY.obs"></fs-data-table>
And we get the error:
Type 'Observable<any> | undefined' is not assignable to type 'Observable<TableData>'.Type 'undefined' is not assignable to type 'Observable<TableData>'.ngtsc(2322)
We need to resolve this.
Approach
Append the Angular non null assertion operator (!
) to obs
in the Angular template.
s.OS.S.SALES_HISTORY.obs!
This tells Angular that the value will not be undefined
.