【发布时间】:2016-06-24 02:12:14
【问题描述】:
我遇到了 TypeScript 错误:
'(element: Conversation) => void' 类型的参数不能分配给'(value: Conversations, index: number, obj: Conversation[]) => boolean'类型的参数。类型 'void' 不能分配给类型 'boolean'。
这是我的架构
export class Conversation {
constructor(
public id: number,
public dateTime: Date,
public image: string,
public isUnread: boolean,
public title: string
) {}
}
这是我的代码
// Mark as read also in data store
this.dataStore.data.find((element) => {
if (element.id === conversationId) {
element.isUnread = true;
// Push the updated list of conversations into the observable stream
this.observer.next(this.dataStore.data);
}
});
这个错误是什么意思?提前谢谢你。
【问题讨论】:
标签: typescript