question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Iterator in TypeScript

See original GitHub issue

I tried using the iterator in typescript this way:

for await (const [key,value] of this.keyv.iterator()) {
            
}

But I get this error:

Type 'AsyncIterator<[string, DeserializedData<string>], any, undefined>' must have a '[Symbol.asyncIterator]()' method that returns an async iterator

How do I resolve this?

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jaredwraycommented, Jun 13, 2022

@remon-nashid - That is a feature that we can enhance by defaulting to the namespace already provided.

0reactions
jaredwraycommented, Jul 15, 2022

@DeveloperInProgress going to close this down as I validated this works also.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Iterators and Generators - TypeScript
An object is deemed iterable if it has an implementation for the Symbol.iterator property. Some built-in types like Array , Map , Set...
Read more >
Iterators in Typescript - DEV Community ‍ ‍
An iterable is any object which implements the @@iterator method. This means that the object (or any object in it's prototype chain) must...
Read more >
Iterators - TypeScript Deep Dive - Gitbook
(More on that <T> notation later) This interface allows to retrieve a value from some collection or sequence which belongs to the object....
Read more >
Typing Iterables and Iterators with TypeScript - geekAbyte
According to the Iteration protocol, an Iterable should have a method named [Symbol.iterator], that when called returns an Iterator. To learn ...
Read more >
Iterator in TypeScript / Design Patterns - Refactoring.Guru
Iterator is a behavioral design pattern that allows sequential traversal through a complex data structure without exposing its internal details.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found