Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Iterator Helpers Typing #59908

Copy link
Copy link
@nikolaybotev

Description

@nikolaybotev
Issue body actions

⚙ Compilation target

ESNext

⚙ Library

lib.esnext.d.ts

Missing / Incorrect Definition

global Iterator class

Sample Code

Iterator.from([1, 2, 3, 4, 5])
  .map(n => n + 1)
  .filter(n => n > 2)
  .drop(1)
  .take(2)
  .toArray() // [4, 5]

See also all the validation tests (working since Node.js 22.0.0) at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator#iterator_helpers

However, the following code should (ideally) continue working:

const customIterator: Iterator<number> = { next: () => ({ value: 42 }) };

Documentation Link

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.