我正在使用 Angular JS typescript (数据来自后端 springmicroservices)。 我正在开发名为 downloadExcel( ) 的新方法
在我的 component.ts 中
Data: {
//rownum: '',
// requestID: '',
student_id: string,
date: Date,
// 'month_id': ''
};
在方法中=>
ExcelDownload() {
const subHeader1 = worksheet.addRow(this.headerData);
subHeader1.getCell(4).value = this.Data(student_id. date); // I do want to retrieve student id and date on my cell (just 2 data)
我收到错误
ERROR in src/app/Summary/Summary.component.ts(902,35): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type '{ student_id: string; date: Date; }' has no compatible call signatures.
有什么建议吗!谢谢
最佳答案
替换
subHeader1.getCell(4).value = this.Data(student_id. date);
与
subHeader1.getCell(4).value = `${this.Data.student_id} ${this.Data.date}`;
数据不是函数
并且在您的数据对象中studnet_id应该是student_id
关于javascript - 错误 TS2349 : Cannot invoke an expression whose type lacks a call signature. 类型 '{ ; }' 没有兼容的调用签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60012028/