Typescript: support of native async/await is missing

Created on 28 Dec 2016  路  4Comments  路  Source: microsoft/TypeScript

TypeScript Version: 2.1.1 / nightly (2.2.0-dev.201xxxxx)

Code


async function f() {
 let value = await anotherAsyncFunction()
  ....
}

Expected behavior:
If target type is set to ES7 (which it currently doesn't even support) it should leave the above code _as is_, since the current versions of Node already support it (and it is much easier to debug, too).

Actual behavior:

  1. Currently it generates the __awaiter code and uses yield, etc.
  2. There's no support for target type es7
Question

Most helpful comment

@dharmax it's still behind a flag, try node --harmony-async-await.

All 4 comments

@dharmax es doesn't follow that versioning semantic anymore. use es2017.

--target esnext should disable all transformations that are not module format related.
@alitaheri did they ever?馃槤

:+1:
@alitaheri oh, i see. I gave it a try and indeed it outputs the right code now. However, seems like my node doesn't understand async, although it's version 7.3....

@dharmax it's still behind a flag, try node --harmony-async-await.

Was this page helpful?
0 / 5 - 0 ratings