Open
Description
Given the following code:
getProposal(id: string) : Promise<Proposal> {
const url = `${this.proposalsUrl}/${id}`;
var headers = new Headers();
this._authService.createAuthorizationHeader(headers);
var options = new RequestOptions({ headers: headers });
return this.http.get(url, options)
.toPromise()
.then(response => plainToClass(Proposal, response.json()));
}
I get the typescript error:
[ts]
Type 'Promise<Proposal[]>' is not assignable to type 'Promise'.
Type 'Proposal[]' is not assignable to type 'Proposal'.
Property 'id' is missing in type 'Proposal[]'.
How did it conclude that the response is an array??