javascript - 错误 TS2349:无法调用其类型缺少调用签名的表达式。类型 '{ ; }' 没有兼容的调用签名
问题描述
我正在使用 Angular JS 打字稿(数据来自后端 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 - 如何在 JS 中回调函数
- typo3 - TYPO3-Slug 不能使用 f:link.action 中的多个参数
- java - 如何通过 CrudRepository 中的嵌入对象进行搜索?
- plot - 未声明的标识符“直方图”
- java - 绕运动体的轴旋转
- r - 匹配日期和类别,然后替换 r 中的值
- jquery - 使用 onClick 功能扩展 jQuery
- docker - 在服务器上构建 docker 映像时出错?
- windows - 为什么 Pandoc 不将 .tex 转换为 .pdf 但会很好地转换 .md?
- javascript - 如何隐藏鼠标悬停在按钮或链接上的光标后的箭头