Typescript: emit generators when targeting es5

Created on 28 Mar 2017  路  2Comments  路  Source: microsoft/TypeScript

TypeScript Version: 2.2.1

When I use generators in my code while targeting es5, the following error appears:
'Generators are only available when targeting ECMAScript 2015 or higher.'
but tslib already provides a generator helper (it's used when converting async functions).
It would be nice if typescript was able to emit bare generators as well.

Duplicate

Most helpful comment

This should be coming in TS 2.3 under ---downlevelIteration flag. You should be able to try it out in typescript@next today.

All 2 comments

This should be coming in TS 2.3 under ---downlevelIteration flag. You should be able to try it out in typescript@next today.

Was this page helpful?
0 / 5 - 0 ratings