'Angular 13 - How to resolve '(): Promise<Object | undefined>' is deprecated.ts(6385)
In my Angular-13 project, I am trying to get the data from API endpoint for chartjs. I have this in the service:
getCurrentEmployeeChart() {
return this.http.get(this.baseUrl + 'current-employee')
.toPromise()
.then((data) => {
return data;
});
}
I got this error:
'(): Promise<Object | undefined>' is deprecated.ts(6385) Observable.d.ts(125, 9): The declaration was marked as deprecated here.
Then:
toPromise()
is crossed.
How do I resolve this?
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
