Transpiling async/await to promises instead of generators for es5 #31621
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Search Terms
transpile async promise
Suggestion
When
target
isES5
, allow an option to transpile async/await to Promises rather than switches. This would require Promises to be polyfilled, hence would be optional.Old issue for this
This was previously discussed on this issue but was closed with this comment by @mhegazy:
@mhegazy can you explain this? I have used
fast-async
to transpile loops to promises before. Is there some edge-case where it is not possible?Use Cases
Current approach creates emitted code that cannot be source-mapped properly by some debuggers.
Examples
Currently emits this:
Instead it should emit something like this (output from fast-async:
Loops
Here's an example of
fast-async
transpiling a loop:becomes
Here's a while loop:
transpiles to:
The text was updated successfully, but these errors were encountered: