typescript 报错 ts2349 this expression is not callable

  • Post author:
  • Post category:其他


members: Member[] | ServerMember[];

这种类型的数组,直接写filter,会报错:ts2349 this expression is not callable

在这里插入图片描述

解决方法,重新封装数组或者使用for循环

// this.notAdimnOwnerList = this.chat_obj_outer.members.filter()
// this.notAdimnOwnerList = this.chat_obj_outer.members.filter(i => !this.typeIsAdminOwner(i.type)).map(item => item.eid);
this.notAdimnOwnerList = [...this.chat_obj_outer.members].filter(i => !this.typeIsAdminOwner(i.type)).map(item => item.eid);
// let notAdimnOwnerList = [];
// for (let i of this.chat_obj_outer.members){
//     if (!this.typeIsAdminOwner(i.type)){
//         notAdimnOwnerList.push(i.eid);
//     };
// };
// this.notAdimnOwnerList = notAdimnOwnerList;



版权声明:本文为weixin_39990025原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。