Skip to content

[require-await] False positive on async generator that uses yield* #1691

Closed
@felixfbecker

Description

@felixfbecker

Repro

{
  "rules": {
    "@typescript-eslint/require-await": "error"
  }
}
async function* foo() {
  await Promise.resolve()
  yield 1
}
async function* bar() {
  yield* foo()
}

Expected Result
No error. bar has to be async because it delegates to foo, which is async.

Actual Result
Error: Async generator function has no 'await' expression.

Additional Info

Versions

package version
@typescript-eslint/eslint-plugin 2.22.0
@typescript-eslint/parser X.Y.Z
TypeScript X.Y.Z
ESLint X.Y.Z
node X.Y.Z
npm X.Y.Z

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions