【发布时间】:2018-11-17 00:56:52
【问题描述】:
知道这里的问题是什么我收到错误“并非所有代码路径都返回值”?
还有没有更好的方法来使用 ES6 而不是 forEach 编写代码?
main.ts
if (rxInfos.length && rxInfos !== undefined) {
rxInfos.forEach((rxInfo: any) => {
// const requestArray: IRequestURL[] = [];
for (const member of specialtyMembers) {
if (member.indexID === rxInfo.indexID) {
proxyMember = member;
if (!member.dateOfBirth) {
statusDesc = "member dateOfbirth not found";
return Promise.reject(this.errorHandler(request, statusDesc));
}
const body: any = this.buildSingleRequestBody(proxyMember, rxInfo);
const requestObject = this.specialtyQuestionRequest(body);
this.requestArray.push(requestObject);
break;
}
}
});
}
【问题讨论】:
标签: javascript arrays angular typescript