danger / danger/danger-js

Await is translated to yield

Open
#973 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.