Skip to content

Private [Symbol.asyncIterator] and [Symbol.iterator] methods incorrectly reported as unused #42051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wojpawlik opened this issue Dec 19, 2020 · 0 comments · May be fixed by #42104
Open

Private [Symbol.asyncIterator] and [Symbol.iterator] methods incorrectly reported as unused #42051

wojpawlik opened this issue Dec 19, 2020 · 0 comments · May be fixed by #42104
Labels
Bug A bug in TypeScript
Milestone

Comments

@wojpawlik
Copy link

TypeScript Version: 4.2.0-dev.20201219

Search Terms:

Symbol.iterator Symbol.asyncIterator

Code

export class Polling {
  private async *[Symbol.asyncIterator]() {}
  private *[Symbol.iterator]() {}

  async loop() {
    for await (const updates of this) {
      void updates
    }
  }
  syncLoop() {
    for (const updates of this) {
      void updates
    }
  }
}

Expected behavior:
No errors.

Actual behavior:

'[Symbol.asyncIterator]' is declared but its value is never read.
'[Symbol.iterator]' is declared but its value is never read.

Playground Link

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Dec 23, 2020
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Dec 23, 2020
Zzzen added a commit to Zzzen/TypeScript that referenced this issue Dec 24, 2020
@Zzzen Zzzen linked a pull request Dec 24, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants