我有这段代码:
_.remove(this.home.modal.data.roles, function (currentObject) {
return currentObject.name === roleToDelete;
});
有人可以告诉我如何将函数调用更改为通常使用Typescript的方式。它也给了我一个错误:
Message 118 TsLint: expected callSignature to have a typedef.
任何建议都将不胜感激。
答案 0 :(得分:0)
这是你正在寻找的东西:
_.remove(this.home.modal.data.roles, (currentObject) => {
return currentObject.name === roleToDelete;
});
您也可以输入" currentObject"像这样:
_.remove(this.home.modal.data.roles, (currentObject: Role) => {
return currentObject.name === roleToDelete;
});