【发布时间】:2021-08-23 17:50:14
【问题描述】:
async fetchDetail(token: string): Promise < object > {
const headersRequest = {
Authorization: `Basic ${token}`,
'Content-Type': 'application/json',
}
return await this.httpService.get( < URL > , {
headers: headersRequest
})
.toPromise()
.then((response): object => response.data)
.catch(() => {
throw new NotFoundException()
})
}
我一直收到这行 .then((response): object => response.data)
的 lint 问题其中规定 不安全地使用“any”类型的表达式
【问题讨论】:
-
错误:/Users/ghostChat/microserviceDetails/src/modules/detailFinder/detailFinder.service.ts:16:35 - 不安全地使用“任何”类型的表达式。这是整个错误声明。错误标记为“response.data”
标签: javascript node.js typescript backend nestjs