microsoft / microsoft/TypeScript
Transpiling async/await to generators instead of es6-Generator-function for es6
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Search Terms
async await es6 transpile generator
Suggestion
If there was a compile option that i can tell the compiler to emit generators instead of es6-Generator-function when targeting es6.
Use Cases
I have to use 3rd-party libs that implemented in es6,so targeting es5 will not work. But i can't write code with async/await when targeting es6 because the platform on which to run the app dose not support yield/funtion* (but other es6 features's ok).
Examples
Checklist
I try Babel and regenerator, all of them transpile es6 code into es5(or other version), but then I can't use 3rd-party libs. Work round is applying transpilation on libs too.
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no source files, tests, or compiler entry points. Start by tracing how TypeScript lowers async/await for an ES6 target and compare the requested generator output with current ES6 output. Done means a clearly defined compiler option produces the requested output without breaking existing targets or behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100