我是打字稿的新手。基本上我有一個typecript GET函數,我想傳遞一個ID來獲取特定的記錄。我在返航線上遇到這個錯誤。在發佈之前,我研究了這一點,但無法獲得與我的場景接近的內容。幫助讚賞!TypeScript:無法調用其類型缺少呼叫簽名的表達式
錯誤TS2349無法調用其類型缺少呼叫 簽名的表達式。
private getRecordRequestUrl = 'http://localhost/Service/api/ReservationRequest/GetRequestById';
getRecordRequest(RequestId: number): Promise<ReservationModel[]> {
return this.http.get(this.getRecordRequestUrl(RequestId))
.toPromise()
.then(response => response.json().Data as ReservationModel[])
.catch(this.handleError);
}
'getRecordRequestUrl'是一個字符串。你正試圖在'this.getRecordRequestUrl()'中調用它。 TypeScript的錯誤實際上就是爲了警告你,它會這樣做。 – deceze