I am attempting to use async/await
in an angular 1.5.5
project.
Given this service method
getDocumentTypes(): angular.IPromise<DocumentType[]> {
var url = "api/document/types";
this.$log.log(url);
return this.$http.get(url).then(_ => _.data);
}
I am attempting to create an async / await
version of the method.
async getDocTypes(): angular.IPromise<DocumentType[]> {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}}
Intellisense shows an error:
TS1055
Type 'angular.IPromise' is not a valid async function return type inES5/ES3
because it does not refer to a Promise-compatible constructor value.
Is there a correct way to use an angular promise in typescript 2.1 with async
/ await
?