Skip to content

Transpiled async generators return a promise value with yield* and rejected promise values #24014

@falsandtru

Description

@falsandtru

@agentcooper Could you also fix this?

TypeScript Version: 2.9.0-dev.20180509

Search Terms:

Code

(async function () {
  async function* g() {
    yield* [Promise.reject(0)];
  }
  try {
    const iter = g();
    console.log(0, await iter.next());
  }
  catch (r) {
    console.log(1, r);
  }
})();

Expected behavior:

Outputs 1, 0, Chrome works so.

Actual behavior:

Outputs 0, Object{value: Promise{}, done: false}.

Playground Link:

Related Issues: #23887

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions