Search code examples
typescriptasync-awaitarrow-functionsecmascript-next

Is async lambda legal in typescript and upcoming ecmascript 7?


These are two related questions:

  1. Is async lambda legal in upcoming EcmaSript standard?

  2. TypeScript follows EcmaScript, and compiler used to complain about async () => { await whatever(); }, and now, with version 1.8, it does not. Is the new behavior intended, or is it a bug?

If ES will allow for async lambda, then TS naturally follows the suite. But, if ES will not support async lambda, will TS properly place this->that substitutions in future code? After all, async lambda exists in C#.


Solution

  • Yes, the proposal currently does cover async arrow functions, and it's unlikely to change that.