Await is translated to yield
- Dominant language
- TypeScript
- Stars
- 5.5k
- Forks
- 381
- Avg merge
- 2h 8m
- Merged PRs (30d)
- 6
Description
Is the `await` keyword purposely translated to `yield`, or what is the relationship between them for the sake of danger-js?
When I use `await` in my dangerfile (in order to access the promise returned by `git.structuredDiffForFile`), if I get an error, the `await` in my code always appears as a `yield` statement.
For example,
```js
const tables = await asyncFuncThatCallsStructuredDiffForFile(arg);
// Becomes:
var tables = yield asyncFuncThatCallsStructuredDiffForFile(arg);
```
If it's relevant, the error I was looking at is an `SyntaxError: Unexpected identifier` which points to the token directly after the `yield`.
Contributor guide
Research direction
Start by reproducing the behavior in a dangerfile that awaits git.structuredDiffForFile, then inspect how the await expression is transformed before the reported SyntaxError. The issue names no source files or tests; done means establishing whether the await-to-yield translation is expected and addressing the resulting behavior or documenting the relationship.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100