If you bind the messages property to an observable and use the async pipe it will throw the following error:
'Message[] | null' is not assignable to type 'Message[]'
The messages should be able to also receive null to avoid the error. The following workarounds can be used until the property is nullable:
<kendo-chat [messages]="(feed | async)!" [user]="patientUser"></kendo-chat>
Or use toSignal:
<kendo-chat [messages]="mySignal()" [user]="patientUser"></kendo-chat>
public feed: Observable<Message[]>;
public mySignal: Signal<Message[]>;
public readonly patientUser: User = {
id: 1,
};
public readonly practitionerUser: User = {
id: 0,
};
constructor() {
const hello: Message = {
author: this.practitionerUser,
suggestedActions: [
{
type: 'reply',
value: 'Neat!',
},
{
type: 'reply',
value: 'Thanks, but this is boring.',
},
],
timestamp: new Date(),
text: 'Hello, this is a demo bot. I don`t do much, but I can count symbols!',
};
this.feed = merge(from([hello])).pipe(
scan((acc: Message[], x: Message) => [...acc, x], [])
);
this.mySignal = toSignal(this.feed ) as Signal<Message[]>;
}