There was a recent Github issue reported on March 28th regarding async arrow functions generating faulty code when targeting ES5, resulting in the error message:
TS1057: An async function or method must have a valid awaitable return type
You can find the original issue on Github here: https://github.com/Microsoft/TypeScript/issues/7706
Microsoft has pledged to provide support for async await
in ES5 browsers by July 21st:
The latest TypeScript 2.1 version is now available on Github. I've already downloaded it and you can view the version in its package.json:
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "http://typescriptlang.org/",
"version": "2.1.0",
"license": "Apache-2.0",
Despite having TypeScript 2.1 installed, I'm still encountering the same error with async arrow functions:
TS1057: An async function or method must have a valid awaitable return type
A new Github issue was opened today addressing this problem: https://github.com/Microsoft/TypeScript/issues/10805
An individual received a response stating that it's a duplicate issue and redirected to the initial one from March before the development of TypeScript 2.1, leading to the closure of the issue.
Is anyone else currently working with async arrow functions (and targeting ES5) or aware of the current status?
Here is a snippet of my code:
async (param1) => {
var var1 = await func1();
}
Any assistance on this matter would be greatly appreciated!